@@ -319,20 +319,23 @@ pub trait SlicePrelude<T> for Sized? {
319
319
/// Returns an iterator over mutable subslices separated by elements that
320
320
/// match `pred`. The matched element is not contained in the subslices.
321
321
#[ unstable = "waiting on unboxed closures, iterator type name conventions" ]
322
- fn split_mut < ' a > ( & ' a mut self , pred: |& T |: ' a -> bool ) -> MutSplits <' a, T >;
322
+ fn split_mut < ' a , P > ( & ' a mut self , pred : P ) -> MutSplits < ' a , T , P > where
323
+ P : FnMut ( & T ) -> bool ;
323
324
324
325
/// Returns an iterator over subslices separated by elements that match
325
326
/// `pred`, limited to splitting at most `n` times. The matched element is
326
327
/// not contained in the subslices.
327
328
#[ unstable = "waiting on unboxed closures, iterator type name conventions" ]
328
- fn splitn_mut < ' a > ( & ' a mut self , n : uint , pred: |& T |: ' a -> bool ) -> SplitsN <MutSplits <' a, T >>;
329
+ fn splitn_mut < ' a , P > ( & ' a mut self , n : uint , pred : P ) -> SplitsN < MutSplits < ' a , T , P > > where
330
+ P : FnMut ( & T ) -> bool ;
329
331
330
332
/// Returns an iterator over subslices separated by elements that match
331
333
/// `pred` limited to splitting at most `n` times. This starts at the end of
332
334
/// the slice and works backwards. The matched element is not contained in
333
335
/// the subslices.
334
336
#[ unstable = "waiting on unboxed closures, iterator type name conventions" ]
335
- fn rsplitn_mut < ' a > ( & ' a mut self , n : uint , pred: |& T |: ' a -> bool ) -> SplitsN <MutSplits <' a, T >>;
337
+ fn rsplitn_mut < ' a , P > ( & ' a mut self , n : uint , pred : P ) -> SplitsN < MutSplits < ' a , T , P > > where
338
+ P : FnMut ( & T ) -> bool ;
336
339
337
340
/// Returns an iterator over `chunk_size` elements of the slice at a time.
338
341
/// The chunks are mutable and do not overlap. If `chunk_size` does
@@ -644,12 +647,14 @@ impl<T> SlicePrelude<T> for [T] {
644
647
}
645
648
646
649
#[ inline]
647
- fn split_mut < ' a > ( & ' a mut self , pred: | & T | : ' a -> bool ) -> MutSplits <' a, T > {
650
+ fn split_mut < ' a , P > ( & ' a mut self , pred : P ) -> MutSplits < ' a , T , P > where P : FnMut ( & T ) -> bool {
648
651
MutSplits { v : self , pred : pred, finished : false }
649
652
}
650
653
651
654
#[ inline]
652
- fn splitn_mut < ' a > ( & ' a mut self , n : uint , pred: |& T |: ' a -> bool ) -> SplitsN <MutSplits <' a, T >> {
655
+ fn splitn_mut < ' a , P > ( & ' a mut self , n : uint , pred : P ) -> SplitsN < MutSplits < ' a , T , P > > where
656
+ P : FnMut ( & T ) -> bool
657
+ {
653
658
SplitsN {
654
659
iter : self . split_mut ( pred) ,
655
660
count : n,
@@ -658,7 +663,9 @@ impl<T> SlicePrelude<T> for [T] {
658
663
}
659
664
660
665
#[ inline]
661
- fn rsplitn_mut < ' a > ( & ' a mut self , n : uint , pred: |& T |: ' a -> bool ) -> SplitsN <MutSplits <' a, T >> {
666
+ fn rsplitn_mut < ' a , P > ( & ' a mut self , n : uint , pred : P ) -> SplitsN < MutSplits < ' a , T , P > > where
667
+ P : FnMut ( & T ) -> bool ,
668
+ {
662
669
SplitsN {
663
670
iter : self . split_mut ( pred) ,
664
671
count : n,
@@ -1337,13 +1344,13 @@ impl<'a, T, P> SplitsIter<&'a [T]> for Splits<'a, T, P> where P: FnMut(&T) -> bo
1337
1344
/// An iterator over the subslices of the vector which are separated
1338
1345
/// by elements that match `pred`.
1339
1346
#[ experimental = "needs review" ]
1340
- pub struct MutSplits < ' a , T : ' a > {
1347
+ pub struct MutSplits < ' a , T : ' a , P > where P : FnMut ( & T ) -> bool {
1341
1348
v : & ' a mut [ T ] ,
1342
- pred : | t : & T | : ' a -> bool ,
1349
+ pred : P ,
1343
1350
finished : bool
1344
1351
}
1345
1352
1346
- impl < ' a , T > SplitsIter < & ' a mut [ T ] > for MutSplits < ' a , T > {
1353
+ impl < ' a , T , P > SplitsIter < & ' a mut [ T ] > for MutSplits < ' a , T , P > where P : FnMut ( & T ) -> bool {
1347
1354
#[ inline]
1348
1355
fn finish ( & mut self ) -> Option < & ' a mut [ T ] > {
1349
1356
if self . finished {
@@ -1356,7 +1363,7 @@ impl<'a, T> SplitsIter<&'a mut [T]> for MutSplits<'a, T> {
1356
1363
}
1357
1364
1358
1365
#[ experimental = "needs review" ]
1359
- impl < ' a , T > Iterator < & ' a mut [ T ] > for MutSplits < ' a , T > {
1366
+ impl < ' a , T , P > Iterator < & ' a mut [ T ] > for MutSplits < ' a , T , P > where P : FnMut ( & T ) -> bool {
1360
1367
#[ inline]
1361
1368
fn next ( & mut self ) -> Option < & ' a mut [ T ] > {
1362
1369
if self . finished { return None ; }
@@ -1389,7 +1396,9 @@ impl<'a, T> Iterator<&'a mut [T]> for MutSplits<'a, T> {
1389
1396
}
1390
1397
1391
1398
#[ experimental = "needs review" ]
1392
- impl < ' a , T > DoubleEndedIterator < & ' a mut [ T ] > for MutSplits < ' a , T > {
1399
+ impl < ' a , T , P > DoubleEndedIterator < & ' a mut [ T ] > for MutSplits < ' a , T , P > where
1400
+ P : FnMut ( & T ) -> bool ,
1401
+ {
1393
1402
#[ inline]
1394
1403
fn next_back ( & mut self ) -> Option < & ' a mut [ T ] > {
1395
1404
if self . finished { return None ; }
0 commit comments