diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2015-01-03 08:19:51 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2015-01-03 09:34:05 -0500 |
| commit | 7095dd00702373dd612d61e191eb57fadce00751 (patch) | |
| tree | cdfc1d5ba74268a44822015b3591b4184b392225 /src/libcore | |
| parent | 6002c13f9bbf2957861a66737df9c9599dcee4be (diff) | |
| download | rust-7095dd00702373dd612d61e191eb57fadce00751.tar.gz rust-7095dd00702373dd612d61e191eb57fadce00751.zip | |
core: merge IteratorPairExt into IteratorExt
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/iter.rs | 16 | ||||
| -rw-r--r-- | src/libcore/prelude.rs | 2 |
2 files changed, 7 insertions, 11 deletions
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index b19cbb54d29..963377ff6b3 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -737,20 +737,15 @@ pub trait IteratorExt: Iterator + Sized { fn rev(self) -> Rev<Self> { Rev{iter: self} } -} - -#[unstable = "trait is unstable"] -impl<I> IteratorExt for I where I: Iterator {} -/// Extention trait for iterators of pairs. -#[unstable = "newly added trait, likely to be merged with IteratorExt"] -pub trait IteratorPairExt<A, B>: Iterator<Item=(A, B)> + Sized { /// Converts an iterator of pairs into a pair of containers. /// /// Loops through the entire iterator, collecting the first component of /// each item into one new container, and the second component into another. - fn unzip<FromA, FromB>(mut self) -> (FromA, FromB) where - FromA: Default + Extend<A>, FromB: Default + Extend<B> + fn unzip<A, B, FromA, FromB>(mut self) -> (FromA, FromB) where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Iterator<Item=(A, B)>, { struct SizeHint<A>(uint, Option<uint>); impl<A> Iterator for SizeHint<A> { @@ -778,7 +773,8 @@ pub trait IteratorPairExt<A, B>: Iterator<Item=(A, B)> + Sized { } } -impl<A, B, I> IteratorPairExt<A, B> for I where I: Iterator<Item=(A, B)> {} +#[unstable = "trait is unstable"] +impl<I> IteratorExt for I where I: Iterator {} /// A range iterator able to yield elements from both ends /// diff --git a/src/libcore/prelude.rs b/src/libcore/prelude.rs index b661fb7ccba..1355825e56d 100644 --- a/src/libcore/prelude.rs +++ b/src/libcore/prelude.rs @@ -44,7 +44,7 @@ pub use cmp::{PartialEq, PartialOrd, Eq, Ord}; pub use iter::{Extend, IteratorExt}; pub use iter::{Iterator, DoubleEndedIterator}; pub use iter::{IteratorCloneExt, CloneIteratorExt}; -pub use iter::{IteratorOrdExt, ExactSizeIterator, IteratorPairExt}; +pub use iter::{IteratorOrdExt, ExactSizeIterator}; pub use option::Option::{mod, Some, None}; pub use ptr::{PtrExt, MutPtrExt}; pub use result::Result::{mod, Ok, Err}; |
