]> git.lizzy.rs Git - rust.git/commitdiff
core: merge DoubleEndedIteratorExt into IteratorExt
authorJorge Aparicio <japaricious@gmail.com>
Sat, 3 Jan 2015 05:28:23 +0000 (00:28 -0500)
committerJorge Aparicio <japaricious@gmail.com>
Sat, 3 Jan 2015 14:34:05 +0000 (09:34 -0500)
src/libcollections/lib.rs
src/libcollections/slice.rs
src/libcollections/str.rs
src/libcore/fmt/float.rs
src/libcore/fmt/num.rs
src/libcore/iter.rs
src/libcore/prelude.rs
src/libcore/str/mod.rs
src/libstd/path/posix.rs
src/libstd/path/windows.rs
src/libstd/prelude/v1.rs

index fac9ab8107a72fbc5578b7c1e144123660b4766d..fb9530882db35ae4e97bb5250a21ce10fede58f7 100644 (file)
@@ -110,7 +110,7 @@ mod prelude {
     pub use core::iter::range;
     pub use core::iter::{FromIterator, Extend, IteratorExt};
     pub use core::iter::{Iterator, DoubleEndedIterator, RandomAccessIterator};
-    pub use core::iter::{IteratorCloneExt, CloneIteratorExt, DoubleEndedIteratorExt};
+    pub use core::iter::{IteratorCloneExt, CloneIteratorExt};
     pub use core::iter::{IteratorOrdExt, MutableDoubleEndedIterator, ExactSizeIterator};
     pub use core::kinds::{Copy, Send, Sized, Sync};
     pub use core::mem::drop;
index 92bdf0be3786259aa3762342cfd5e8d4779e4bf9..5db4e8580d0a49fde6105b78835e64eb0c7370e4 100644 (file)
@@ -1449,7 +1449,7 @@ pub mod raw {
 mod tests {
     use std::boxed::Box;
     use prelude::{Some, None, range, Vec, ToString, Clone, Greater, Less, Equal};
-    use prelude::{SliceExt, Iterator, IteratorExt, DoubleEndedIteratorExt};
+    use prelude::{SliceExt, Iterator, IteratorExt};
     use prelude::AsSlice;
     use prelude::{RandomAccessIterator, Ord, SliceConcatExt};
     use core::cell::Cell;
index 7f35e5fd1ca0a8c6b30af99c8112680fcd47751c..6c51480931b3b3841a6cfbaae122fbef0e07b0fe 100644 (file)
@@ -3278,7 +3278,7 @@ fn test_into_maybe_owned() {
 #[cfg(test)]
 mod bench {
     use super::*;
-    use prelude::{SliceExt, IteratorExt, DoubleEndedIteratorExt, SliceConcatExt};
+    use prelude::{SliceExt, IteratorExt, SliceConcatExt};
     use test::Bencher;
     use test::black_box;
 
index a39168ec1ec82bd0a33eb5dc060c9db1f9ee3e72..27023fab858d939c6e688e56cc8b9bd6ba16f180 100644 (file)
@@ -17,7 +17,7 @@
 use char;
 use char::Char;
 use fmt;
-use iter::{range, DoubleEndedIteratorExt};
+use iter::{IteratorExt, range};
 use num::{cast, Float, ToPrimitive};
 use num::FpCategory as Fp;
 use ops::FnOnce;
index 4f0cecbb24353abc591c84fea56ef35fda598c25..e680230265aa65e99f2ea452e026617501f81b71 100644 (file)
@@ -15,7 +15,7 @@
 #![allow(unsigned_negation)]
 
 use fmt;
-use iter::DoubleEndedIteratorExt;
+use iter::IteratorExt;
 use num::{Int, cast};
 use slice::SliceExt;
 use str;
index c4b3531d539263afbf99006359bb92b85d2d8341..b19cbb54d29c805d0a12c24221ec8a12bdb8b715 100644 (file)
@@ -719,6 +719,24 @@ fn min_by<B: Ord, F>(self, mut f: F) -> Option< <Self as Iterator>::Item> where
             }
         }).map(|(x, _)| x)
     }
+
+    /// Change the direction of the iterator
+    ///
+    /// The flipped iterator swaps the ends on an iterator that can already
+    /// be iterated from the front and from the back.
+    ///
+    ///
+    /// If the iterator also implements RandomAccessIterator, the flipped
+    /// iterator is also random access, with the indices starting at the back
+    /// of the original iterator.
+    ///
+    /// Note: Random access with flipped indices still only applies to the first
+    /// `uint::MAX` elements of the original iterator.
+    #[inline]
+    #[stable]
+    fn rev(self) -> Rev<Self> {
+        Rev{iter: self}
+    }
 }
 
 #[unstable = "trait is unstable"]
@@ -772,31 +790,6 @@ pub trait DoubleEndedIterator: Iterator {
     fn next_back(&mut self) -> Option< <Self as Iterator>::Item>;
 }
 
-/// Extension methods for double-ended iterators.
-#[unstable = "new extension trait convention"]
-pub trait DoubleEndedIteratorExt: DoubleEndedIterator + Sized {
-    /// Change the direction of the iterator
-    ///
-    /// The flipped iterator swaps the ends on an iterator that can already
-    /// be iterated from the front and from the back.
-    ///
-    ///
-    /// If the iterator also implements RandomAccessIterator, the flipped
-    /// iterator is also random access, with the indices starting at the back
-    /// of the original iterator.
-    ///
-    /// Note: Random access with flipped indices still only applies to the first
-    /// `uint::MAX` elements of the original iterator.
-    #[inline]
-    #[stable]
-    fn rev(self) -> Rev<Self> {
-        Rev{iter: self}
-    }
-}
-
-#[unstable = "trait is unstable"]
-impl<I> DoubleEndedIteratorExt for I where I: DoubleEndedIterator {}
-
 /// A double-ended iterator yielding mutable references
 #[experimental = "not widely used"]
 pub trait MutableDoubleEndedIterator {
index 8cb631380095f06b26025d8bc9d47b68c03b1aac..b661fb7ccba8ddeca29ca74a51c3806fe7a0d6a6 100644 (file)
@@ -42,7 +42,7 @@
 pub use clone::Clone;
 pub use cmp::{PartialEq, PartialOrd, Eq, Ord};
 pub use iter::{Extend, IteratorExt};
-pub use iter::{Iterator, DoubleEndedIterator, DoubleEndedIteratorExt};
+pub use iter::{Iterator, DoubleEndedIterator};
 pub use iter::{IteratorCloneExt, CloneIteratorExt};
 pub use iter::{IteratorOrdExt, ExactSizeIterator, IteratorPairExt};
 pub use option::Option::{mod, Some, None};
index 8df072c9d466f9c335ffff1179563de13ba9d68b..7e99e4236083ec8666b809b4593d975773eadc55 100644 (file)
@@ -21,7 +21,7 @@
 use cmp::{mod, Eq};
 use default::Default;
 use iter::range;
-use iter::{DoubleEndedIteratorExt, ExactSizeIterator};
+use iter::ExactSizeIterator;
 use iter::{Map, Iterator, IteratorExt, DoubleEndedIterator};
 use kinds::Sized;
 use mem;
index 6075010f3b5ffdb95f0b9c806fb3adef6cc2b229..39b96ef6aeea0e7ef0346562fdcd890f24a8a642 100644 (file)
@@ -15,7 +15,7 @@
 use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
 use hash;
 use io::Writer;
-use iter::{DoubleEndedIteratorExt, AdditiveIterator, Extend};
+use iter::{AdditiveIterator, Extend};
 use iter::{Iterator, IteratorExt, Map};
 use option::Option;
 use option::Option::{None, Some};
@@ -449,7 +449,7 @@ mod tests {
     use super::*;
 
     use clone::Clone;
-    use iter::{IteratorExt, DoubleEndedIteratorExt};
+    use iter::IteratorExt;
     use option::Option::{mod, Some, None};
     use path::GenericPath;
     use slice::{AsSlice, SliceExt};
index 55086ad3a23f98d5bb7143af8b3a479e770a7500..f6fb149e82cf68f0201678745e2f8e4ffc26e748 100644 (file)
@@ -20,7 +20,7 @@
 use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
 use hash;
 use io::Writer;
-use iter::{AdditiveIterator, DoubleEndedIteratorExt, Extend};
+use iter::{AdditiveIterator, Extend};
 use iter::{Iterator, IteratorExt, Map, repeat};
 use mem;
 use option::Option;
@@ -1124,7 +1124,7 @@ mod tests {
     use super::*;
 
     use clone::Clone;
-    use iter::{IteratorExt, DoubleEndedIteratorExt};
+    use iter::IteratorExt;
     use option::Option::{mod, Some, None};
     use path::GenericPath;
     use slice::{AsSlice, SliceExt};
index cb5dfafb4a12380dbfb24f047d091811c11f2894..dea2749c18255dae602e3746676898c1afa27b50 100644 (file)
@@ -27,7 +27,6 @@
 #[stable] #[doc(no_inline)] pub use cmp::{PartialEq, PartialOrd, Eq, Ord};
 #[stable] #[doc(no_inline)] pub use iter::CloneIteratorExt;
 #[stable] #[doc(no_inline)] pub use iter::DoubleEndedIterator;
-#[stable] #[doc(no_inline)] pub use iter::DoubleEndedIteratorExt;
 #[stable] #[doc(no_inline)] pub use iter::ExactSizeIterator;
 #[stable] #[doc(no_inline)] pub use iter::{Iterator, IteratorExt, Extend};
 #[stable] #[doc(no_inline)] pub use iter::{IteratorCloneExt, IteratorOrdExt};