From 962a753890f801c378b3cb244b7d7ca3cae164a5 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Fri, 19 Apr 2013 07:28:51 -0400 Subject: [PATCH] takewhile -> take_while, dropwhile -> skip_while --- src/libcore/iterator.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/libcore/iterator.rs b/src/libcore/iterator.rs index 996951e8219..1887e0cec80 100644 --- a/src/libcore/iterator.rs +++ b/src/libcore/iterator.rs @@ -22,8 +22,8 @@ pub trait IteratorUtil { // FIXME: #5898: should be called map fn transform<'r, B>(self, f: &'r fn(A) -> B) -> MapIterator<'r, A, B, Self>; fn filter<'r>(self, predicate: &'r fn(&A) -> bool) -> FilterIterator<'r, A, Self>; - fn dropwhile<'r>(self, predicate: &'r fn(&A) -> bool) -> DropWhileIterator<'r, A, Self>; - fn takewhile<'r>(self, predicate: &'r fn(&A) -> bool) -> TakeWhileIterator<'r, A, Self>; + fn skip_while<'r>(self, predicate: &'r fn(&A) -> bool) -> SkipWhileIterator<'r, A, Self>; + fn take_while<'r>(self, predicate: &'r fn(&A) -> bool) -> TakeWhileIterator<'r, A, Self>; fn skip(self, n: uint) -> SkipIterator; fn take(self, n: uint) -> TakeIterator; fn enumerate(self) -> EnumerateIterator; @@ -53,12 +53,12 @@ fn enumerate(self) -> EnumerateIterator { } #[inline(always)] - fn dropwhile<'r>(self, predicate: &'r fn(&A) -> bool) -> DropWhileIterator<'r, A, T> { - DropWhileIterator{iter: self, flag: false, predicate: predicate} + fn skip_while<'r>(self, predicate: &'r fn(&A) -> bool) -> SkipWhileIterator<'r, A, T> { + SkipWhileIterator{iter: self, flag: false, predicate: predicate} } #[inline(always)] - fn takewhile<'r>(self, predicate: &'r fn(&A) -> bool) -> TakeWhileIterator<'r, A, T> { + fn take_while<'r>(self, predicate: &'r fn(&A) -> bool) -> TakeWhileIterator<'r, A, T> { TakeWhileIterator{iter: self, flag: false, predicate: predicate} } @@ -154,13 +154,13 @@ fn next(&mut self) -> Option<(uint, A)> { } } -pub struct DropWhileIterator<'self, A, T> { +pub struct SkipWhileIterator<'self, A, T> { priv iter: T, priv flag: bool, priv predicate: &'self fn(&A) -> bool } -impl<'self, A, T: Iterator> Iterator for DropWhileIterator<'self, A, T> { +impl<'self, A, T: Iterator> Iterator for SkipWhileIterator<'self, A, T> { #[inline] fn next(&mut self) -> Option { let mut next = self.iter.next();