@@ -346,8 +346,9 @@ pub trait IteratorExt<A>: Iterator<A> {
346
346
/// ```
347
347
#[ inline]
348
348
#[ unstable = "waiting for unboxed closures" ]
349
- fn scan < ' r , St , B > ( self , initial_state : St , f : |& mut St , A |: ' r -> Option <B >)
350
- -> Scan <' r, A , B , Self , St > {
349
+ fn scan < St , B , F > ( self , initial_state : St , f : F ) -> Scan < A , B , Self , St , F > where
350
+ F : FnMut ( & mut St , A ) -> Option < B > ,
351
+ {
351
352
Scan { iter : self , f : f, state : initial_state}
352
353
}
353
354
@@ -1833,16 +1834,19 @@ impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<A> for Take<T> {
1833
1834
/// An iterator to maintain state while iterating another iterator
1834
1835
#[ must_use = "iterator adaptors are lazy and do nothing unless consumed" ]
1835
1836
#[ unstable = "waiting for unboxed closures" ]
1836
- pub struct Scan < ' a , A , B , T , St > {
1837
- iter : T ,
1838
- f : | & mut St , A | : ' a -> Option < B > ,
1837
+ pub struct Scan < A , B , I , St , F > where I : Iterator < A > , F : FnMut ( & mut St , A ) -> Option < B > {
1838
+ iter : I ,
1839
+ f : F ,
1839
1840
1840
1841
/// The current internal state to be passed to the closure next.
1841
1842
pub state : St ,
1842
1843
}
1843
1844
1844
1845
#[ unstable = "trait is unstable" ]
1845
- impl < ' a , A , B , T : Iterator < A > , St > Iterator < B > for Scan < ' a , A , B , T , St > {
1846
+ impl < A , B , I , St , F > Iterator < B > for Scan < A , B , I , St , F > where
1847
+ I : Iterator < A > ,
1848
+ F : FnMut ( & mut St , A ) -> Option < B > ,
1849
+ {
1846
1850
#[ inline]
1847
1851
fn next ( & mut self ) -> Option < B > {
1848
1852
self . iter . next ( ) . and_then ( |a| ( self . f ) ( & mut self . state , a) )
0 commit comments