add an associated Item
type to IntoIterator
This commit is contained in:
parent
cf636c233d
commit
e7273784c7
@ -655,6 +655,8 @@ impl<T: Ord> FromIterator<T> for BinaryHeap<T> {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<T: Ord> IntoIterator for BinaryHeap<T> {
|
||||
type IntoIter = IntoIter<T>;
|
||||
|
||||
@ -663,6 +665,18 @@ impl<T: Ord> IntoIterator for BinaryHeap<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<T: Ord> IntoIterator for BinaryHeap<T> {
|
||||
type Item = T;
|
||||
type IntoIter = IntoIter<T>;
|
||||
|
||||
fn into_iter(self) -> IntoIter<T> {
|
||||
self.into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, T> IntoIterator for &'a BinaryHeap<T> where T: Ord {
|
||||
type IntoIter = Iter<'a, T>;
|
||||
|
||||
@ -671,6 +685,16 @@ impl<'a, T> IntoIterator for &'a BinaryHeap<T> where T: Ord {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, T> IntoIterator for &'a BinaryHeap<T> where T: Ord {
|
||||
type Item = &'a T;
|
||||
type IntoIter = Iter<'a, T>;
|
||||
|
||||
fn into_iter(self) -> Iter<'a, T> {
|
||||
self.iter()
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: Ord> Extend<T> for BinaryHeap<T> {
|
||||
fn extend<Iter: Iterator<Item=T>>(&mut self, iter: Iter) {
|
||||
|
@ -1070,6 +1070,8 @@ impl<'a> RandomAccessIterator for Iter<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a> IntoIterator for &'a Bitv {
|
||||
type IntoIter = Iter<'a>;
|
||||
|
||||
@ -1078,6 +1080,16 @@ impl<'a> IntoIterator for &'a Bitv {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a> IntoIterator for &'a Bitv {
|
||||
type Item = bool;
|
||||
type IntoIter = Iter<'a>;
|
||||
|
||||
fn into_iter(self) -> Iter<'a> {
|
||||
self.iter()
|
||||
}
|
||||
}
|
||||
|
||||
/// An implementation of a set using a bit vector as an underlying
|
||||
/// representation for holding unsigned numerical elements.
|
||||
///
|
||||
@ -1882,6 +1894,8 @@ impl<'a> Iterator for SymmetricDifference<'a> {
|
||||
#[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.0.size_hint() }
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a> IntoIterator for &'a BitvSet {
|
||||
type IntoIter = SetIter<'a>;
|
||||
|
||||
@ -1890,6 +1904,16 @@ impl<'a> IntoIterator for &'a BitvSet {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a> IntoIterator for &'a BitvSet {
|
||||
type Item = usize;
|
||||
type IntoIter = SetIter<'a>;
|
||||
|
||||
fn into_iter(self) -> SetIter<'a> {
|
||||
self.iter()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use prelude::*;
|
||||
|
@ -462,6 +462,8 @@ impl<K: Ord, V> BTreeMap<K, V> {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<K, V> IntoIterator for BTreeMap<K, V> {
|
||||
type IntoIter = IntoIter<K, V>;
|
||||
|
||||
@ -470,6 +472,18 @@ impl<K, V> IntoIterator for BTreeMap<K, V> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<K, V> IntoIterator for BTreeMap<K, V> {
|
||||
type Item = (K, V);
|
||||
type IntoIter = IntoIter<K, V>;
|
||||
|
||||
fn into_iter(self) -> IntoIter<K, V> {
|
||||
self.into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, K, V> IntoIterator for &'a BTreeMap<K, V> {
|
||||
type IntoIter = Iter<'a, K, V>;
|
||||
|
||||
@ -478,6 +492,18 @@ impl<'a, K, V> IntoIterator for &'a BTreeMap<K, V> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, K, V> IntoIterator for &'a BTreeMap<K, V> {
|
||||
type Item = (&'a K, &'a V);
|
||||
type IntoIter = Iter<'a, K, V>;
|
||||
|
||||
fn into_iter(self) -> Iter<'a, K, V> {
|
||||
self.iter()
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, K, V> IntoIterator for &'a mut BTreeMap<K, V> {
|
||||
type IntoIter = IterMut<'a, K, V>;
|
||||
|
||||
@ -486,6 +512,16 @@ impl<'a, K, V> IntoIterator for &'a mut BTreeMap<K, V> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, K, V> IntoIterator for &'a mut BTreeMap<K, V> {
|
||||
type Item = (&'a K, &'a mut V);
|
||||
type IntoIter = IterMut<'a, K, V>;
|
||||
|
||||
fn into_iter(mut self) -> IterMut<'a, K, V> {
|
||||
self.iter_mut()
|
||||
}
|
||||
}
|
||||
|
||||
/// A helper enum useful for deciding whether to continue a loop since we can't
|
||||
/// return from a closure
|
||||
enum Continuation<A, B> {
|
||||
|
@ -480,6 +480,8 @@ impl<T: Ord> FromIterator<T> for BTreeSet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<T> IntoIterator for BTreeSet<T> {
|
||||
type IntoIter = IntoIter<T>;
|
||||
|
||||
@ -488,6 +490,18 @@ impl<T> IntoIterator for BTreeSet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<T> IntoIterator for BTreeSet<T> {
|
||||
type Item = T;
|
||||
type IntoIter = IntoIter<T>;
|
||||
|
||||
fn into_iter(self) -> IntoIter<T> {
|
||||
self.into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, T> IntoIterator for &'a BTreeSet<T> {
|
||||
type IntoIter = Iter<'a, T>;
|
||||
|
||||
@ -496,6 +510,16 @@ impl<'a, T> IntoIterator for &'a BTreeSet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, T> IntoIterator for &'a BTreeSet<T> {
|
||||
type Item = &'a T;
|
||||
type IntoIter = Iter<'a, T>;
|
||||
|
||||
fn into_iter(self) -> Iter<'a, T> {
|
||||
self.iter()
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: Ord> Extend<T> for BTreeSet<T> {
|
||||
#[inline]
|
||||
|
@ -830,6 +830,8 @@ impl<A> FromIterator<A> for DList<A> {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<T> IntoIterator for DList<T> {
|
||||
type IntoIter = IntoIter<T>;
|
||||
|
||||
@ -838,6 +840,18 @@ impl<T> IntoIterator for DList<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<T> IntoIterator for DList<T> {
|
||||
type Item = T;
|
||||
type IntoIter = IntoIter<T>;
|
||||
|
||||
fn into_iter(self) -> IntoIter<T> {
|
||||
self.into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, T> IntoIterator for &'a DList<T> {
|
||||
type IntoIter = Iter<'a, T>;
|
||||
|
||||
@ -846,6 +860,18 @@ impl<'a, T> IntoIterator for &'a DList<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, T> IntoIterator for &'a DList<T> {
|
||||
type Item = &'a T;
|
||||
type IntoIter = Iter<'a, T>;
|
||||
|
||||
fn into_iter(self) -> Iter<'a, T> {
|
||||
self.iter()
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, T> IntoIterator for &'a mut DList<T> {
|
||||
type IntoIter = IterMut<'a, T>;
|
||||
|
||||
@ -854,6 +880,16 @@ impl<'a, T> IntoIterator for &'a mut DList<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, T> IntoIterator for &'a mut DList<T> {
|
||||
type Item = &'a mut T;
|
||||
type IntoIter = IterMut<'a, T>;
|
||||
|
||||
fn into_iter(mut self) -> IterMut<'a, T> {
|
||||
self.iter_mut()
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A> Extend<A> for DList<A> {
|
||||
fn extend<T: Iterator<Item=A>>(&mut self, iterator: T) {
|
||||
|
@ -257,6 +257,8 @@ impl<E:CLike> FromIterator<E> for EnumSet<E> {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, E> IntoIterator for &'a EnumSet<E> where E: CLike {
|
||||
type IntoIter = Iter<E>;
|
||||
|
||||
@ -265,6 +267,16 @@ impl<'a, E> IntoIterator for &'a EnumSet<E> where E: CLike {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, E> IntoIterator for &'a EnumSet<E> where E: CLike {
|
||||
type Item = E;
|
||||
type IntoIter = Iter<E>;
|
||||
|
||||
fn into_iter(self) -> Iter<E> {
|
||||
self.iter()
|
||||
}
|
||||
}
|
||||
|
||||
impl<E:CLike> Extend<E> for EnumSet<E> {
|
||||
fn extend<I: Iterator<Item=E>>(&mut self, iterator: I) {
|
||||
for element in iterator {
|
||||
|
@ -1607,6 +1607,8 @@ impl<A> FromIterator<A> for RingBuf<A> {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<T> IntoIterator for RingBuf<T> {
|
||||
type IntoIter = IntoIter<T>;
|
||||
|
||||
@ -1615,6 +1617,18 @@ impl<T> IntoIterator for RingBuf<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<T> IntoIterator for RingBuf<T> {
|
||||
type Item = T;
|
||||
type IntoIter = IntoIter<T>;
|
||||
|
||||
fn into_iter(self) -> IntoIter<T> {
|
||||
self.into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, T> IntoIterator for &'a RingBuf<T> {
|
||||
type IntoIter = Iter<'a, T>;
|
||||
|
||||
@ -1623,6 +1637,18 @@ impl<'a, T> IntoIterator for &'a RingBuf<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, T> IntoIterator for &'a RingBuf<T> {
|
||||
type Item = &'a T;
|
||||
type IntoIter = Iter<'a, T>;
|
||||
|
||||
fn into_iter(self) -> Iter<'a, T> {
|
||||
self.iter()
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, T> IntoIterator for &'a mut RingBuf<T> {
|
||||
type IntoIter = IterMut<'a, T>;
|
||||
|
||||
@ -1631,6 +1657,16 @@ impl<'a, T> IntoIterator for &'a mut RingBuf<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, T> IntoIterator for &'a mut RingBuf<T> {
|
||||
type Item = &'a mut T;
|
||||
type IntoIter = IterMut<'a, T>;
|
||||
|
||||
fn into_iter(mut self) -> IterMut<'a, T> {
|
||||
self.iter_mut()
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A> Extend<A> for RingBuf<A> {
|
||||
fn extend<T: Iterator<Item=A>>(&mut self, iterator: T) {
|
||||
|
@ -1393,6 +1393,8 @@ impl<T> FromIterator<T> for Vec<T> {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<T> IntoIterator for Vec<T> {
|
||||
type IntoIter = IntoIter<T>;
|
||||
|
||||
@ -1401,6 +1403,18 @@ impl<T> IntoIterator for Vec<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<T> IntoIterator for Vec<T> {
|
||||
type Item = T;
|
||||
type IntoIter = IntoIter<T>;
|
||||
|
||||
fn into_iter(self) -> IntoIter<T> {
|
||||
self.into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, T> IntoIterator for &'a Vec<T> {
|
||||
type IntoIter = slice::Iter<'a, T>;
|
||||
|
||||
@ -1409,6 +1423,18 @@ impl<'a, T> IntoIterator for &'a Vec<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, T> IntoIterator for &'a Vec<T> {
|
||||
type Item = &'a T;
|
||||
type IntoIter = slice::Iter<'a, T>;
|
||||
|
||||
fn into_iter(self) -> slice::Iter<'a, T> {
|
||||
self.iter()
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, T> IntoIterator for &'a mut Vec<T> {
|
||||
type IntoIter = slice::IterMut<'a, T>;
|
||||
|
||||
@ -1417,6 +1443,16 @@ impl<'a, T> IntoIterator for &'a mut Vec<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, T> IntoIterator for &'a mut Vec<T> {
|
||||
type Item = &'a mut T;
|
||||
type IntoIter = slice::IterMut<'a, T>;
|
||||
|
||||
fn into_iter(mut self) -> slice::IterMut<'a, T> {
|
||||
self.iter_mut()
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "collections", reason = "waiting on Extend stability")]
|
||||
impl<T> Extend<T> for Vec<T> {
|
||||
#[inline]
|
||||
|
@ -668,6 +668,8 @@ impl<V> FromIterator<(usize, V)> for VecMap<V> {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<T> IntoIterator for VecMap<T> {
|
||||
type IntoIter = IntoIter<T>;
|
||||
|
||||
@ -676,6 +678,18 @@ impl<T> IntoIterator for VecMap<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<T> IntoIterator for VecMap<T> {
|
||||
type Item = (usize, T);
|
||||
type IntoIter = IntoIter<T>;
|
||||
|
||||
fn into_iter(self) -> IntoIter<T> {
|
||||
self.into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, T> IntoIterator for &'a VecMap<T> {
|
||||
type IntoIter = Iter<'a, T>;
|
||||
|
||||
@ -684,6 +698,18 @@ impl<'a, T> IntoIterator for &'a VecMap<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, T> IntoIterator for &'a VecMap<T> {
|
||||
type Item = (usize, &'a T);
|
||||
type IntoIter = Iter<'a, T>;
|
||||
|
||||
fn into_iter(self) -> Iter<'a, T> {
|
||||
self.iter()
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, T> IntoIterator for &'a mut VecMap<T> {
|
||||
type IntoIter = IterMut<'a, T>;
|
||||
|
||||
@ -692,6 +718,16 @@ impl<'a, T> IntoIterator for &'a mut VecMap<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, T> IntoIterator for &'a mut VecMap<T> {
|
||||
type Item = (usize, &'a mut T);
|
||||
type IntoIter = IterMut<'a, T>;
|
||||
|
||||
fn into_iter(mut self) -> IterMut<'a, T> {
|
||||
self.iter_mut()
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<V> Extend<(usize, V)> for VecMap<V> {
|
||||
fn extend<Iter: Iterator<Item=(usize, V)>>(&mut self, iter: Iter) {
|
||||
|
@ -48,6 +48,8 @@ macro_rules! array_impls {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, T> IntoIterator for &'a [T; $N] {
|
||||
type IntoIter = Iter<'a, T>;
|
||||
|
||||
@ -56,6 +58,18 @@ macro_rules! array_impls {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, T> IntoIterator for &'a [T; $N] {
|
||||
type Item = &'a T;
|
||||
type IntoIter = Iter<'a, T>;
|
||||
|
||||
fn into_iter(self) -> Iter<'a, T> {
|
||||
self.iter()
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, T> IntoIterator for &'a mut [T; $N] {
|
||||
type IntoIter = IterMut<'a, T>;
|
||||
|
||||
@ -64,6 +78,16 @@ macro_rules! array_impls {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, T> IntoIterator for &'a mut [T; $N] {
|
||||
type Item = &'a mut T;
|
||||
type IntoIter = IterMut<'a, T>;
|
||||
|
||||
fn into_iter(self) -> IterMut<'a, T> {
|
||||
self.iter_mut()
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<A, B> PartialEq<[B; $N]> for [A; $N] where A: PartialEq<B> {
|
||||
#[inline]
|
||||
|
@ -118,6 +118,8 @@ pub trait FromIterator<A> {
|
||||
fn from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove trait after a snapshot
|
||||
#[cfg(stage0)]
|
||||
/// Conversion into an `Iterator`
|
||||
pub trait IntoIterator {
|
||||
type IntoIter: Iterator;
|
||||
@ -127,6 +129,19 @@ pub trait IntoIterator {
|
||||
fn into_iter(self) -> Self::IntoIter;
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
/// Conversion into an `Iterator`
|
||||
pub trait IntoIterator {
|
||||
type Item;
|
||||
type IntoIter: Iterator<Item=Self::Item>;
|
||||
|
||||
/// Consumes `Self` and returns an iterator over it
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn into_iter(self) -> Self::IntoIter;
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<I> IntoIterator for I where I: Iterator {
|
||||
type IntoIter = I;
|
||||
|
||||
@ -135,6 +150,16 @@ impl<I> IntoIterator for I where I: Iterator {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<I: Iterator> IntoIterator for I {
|
||||
type Item = I::Item;
|
||||
type IntoIter = I;
|
||||
|
||||
fn into_iter(self) -> I {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
/// A type growable from an `Iterator` implementation
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub trait Extend<A> {
|
||||
|
@ -626,6 +626,8 @@ impl<'a, T> Default for &'a [T] {
|
||||
// Iterators
|
||||
//
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, T> IntoIterator for &'a [T] {
|
||||
type IntoIter = Iter<'a, T>;
|
||||
|
||||
@ -634,6 +636,18 @@ impl<'a, T> IntoIterator for &'a [T] {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, T> IntoIterator for &'a [T] {
|
||||
type Item = &'a T;
|
||||
type IntoIter = Iter<'a, T>;
|
||||
|
||||
fn into_iter(self) -> Iter<'a, T> {
|
||||
self.iter()
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, T> IntoIterator for &'a mut [T] {
|
||||
type IntoIter = IterMut<'a, T>;
|
||||
|
||||
@ -642,6 +656,16 @@ impl<'a, T> IntoIterator for &'a mut [T] {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, T> IntoIterator for &'a mut [T] {
|
||||
type Item = &'a mut T;
|
||||
type IntoIter = IterMut<'a, T>;
|
||||
|
||||
fn into_iter(self) -> IterMut<'a, T> {
|
||||
self.iter_mut()
|
||||
}
|
||||
}
|
||||
|
||||
// The shared definition of the `Iter` and `IterMut` iterators
|
||||
macro_rules! iterator {
|
||||
(struct $name:ident -> $ptr:ty, $elem:ty) => {
|
||||
|
@ -530,6 +530,8 @@ impl<'a,T> Iterator for EnumeratedItems<'a,T> {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<T> IntoIterator for VecPerParamSpace<T> {
|
||||
type IntoIter = IntoIter<T>;
|
||||
|
||||
@ -538,6 +540,18 @@ impl<T> IntoIterator for VecPerParamSpace<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<T> IntoIterator for VecPerParamSpace<T> {
|
||||
type Item = T;
|
||||
type IntoIter = IntoIter<T>;
|
||||
|
||||
fn into_iter(self) -> IntoIter<T> {
|
||||
self.into_vec().into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a,T> IntoIterator for &'a VecPerParamSpace<T> {
|
||||
type IntoIter = Iter<'a, T>;
|
||||
|
||||
@ -546,6 +560,16 @@ impl<'a,T> IntoIterator for &'a VecPerParamSpace<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a,T> IntoIterator for &'a VecPerParamSpace<T> {
|
||||
type Item = &'a T;
|
||||
type IntoIter = Iter<'a, T>;
|
||||
|
||||
fn into_iter(self) -> Iter<'a, T> {
|
||||
self.as_slice().into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Public trait `Subst`
|
||||
|
@ -1372,6 +1372,8 @@ enum VacantEntryState<K, V, M> {
|
||||
NoElem(EmptyBucket<K, V, M>),
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, K, V, S, H> IntoIterator for &'a HashMap<K, V, S>
|
||||
where K: Eq + Hash<H>,
|
||||
S: HashState<Hasher=H>,
|
||||
@ -1384,6 +1386,22 @@ impl<'a, K, V, S, H> IntoIterator for &'a HashMap<K, V, S>
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, K, V, S, H> IntoIterator for &'a HashMap<K, V, S>
|
||||
where K: Eq + Hash<H>,
|
||||
S: HashState<Hasher=H>,
|
||||
H: hash::Hasher<Output=u64>
|
||||
{
|
||||
type Item = (&'a K, &'a V);
|
||||
type IntoIter = Iter<'a, K, V>;
|
||||
|
||||
fn into_iter(self) -> Iter<'a, K, V> {
|
||||
self.iter()
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, K, V, S, H> IntoIterator for &'a mut HashMap<K, V, S>
|
||||
where K: Eq + Hash<H>,
|
||||
S: HashState<Hasher=H>,
|
||||
@ -1396,6 +1414,22 @@ impl<'a, K, V, S, H> IntoIterator for &'a mut HashMap<K, V, S>
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, K, V, S, H> IntoIterator for &'a mut HashMap<K, V, S>
|
||||
where K: Eq + Hash<H>,
|
||||
S: HashState<Hasher=H>,
|
||||
H: hash::Hasher<Output=u64>
|
||||
{
|
||||
type Item = (&'a K, &'a mut V);
|
||||
type IntoIter = IterMut<'a, K, V>;
|
||||
|
||||
fn into_iter(mut self) -> IterMut<'a, K, V> {
|
||||
self.iter_mut()
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<K, V, S, H> IntoIterator for HashMap<K, V, S>
|
||||
where K: Eq + Hash<H>,
|
||||
S: HashState<Hasher=H>,
|
||||
@ -1408,6 +1442,20 @@ impl<K, V, S, H> IntoIterator for HashMap<K, V, S>
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<K, V, S, H> IntoIterator for HashMap<K, V, S>
|
||||
where K: Eq + Hash<H>,
|
||||
S: HashState<Hasher=H>,
|
||||
H: hash::Hasher<Output=u64>
|
||||
{
|
||||
type Item = (K, V);
|
||||
type IntoIter = IntoIter<K, V>;
|
||||
|
||||
fn into_iter(self) -> IntoIter<K, V> {
|
||||
self.into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, K, V> Iterator for Iter<'a, K, V> {
|
||||
type Item = (&'a K, &'a V);
|
||||
|
@ -835,6 +835,8 @@ pub struct Union<'a, T: 'a, S: 'a> {
|
||||
iter: Chain<Iter<'a, T>, Difference<'a, T, S>>
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, T, S, H> IntoIterator for &'a HashSet<T, S>
|
||||
where T: Eq + Hash<H>,
|
||||
S: HashState<Hasher=H>,
|
||||
@ -847,6 +849,22 @@ impl<'a, T, S, H> IntoIterator for &'a HashSet<T, S>
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, T, S, H> IntoIterator for &'a HashSet<T, S>
|
||||
where T: Eq + Hash<H>,
|
||||
S: HashState<Hasher=H>,
|
||||
H: hash::Hasher<Output=u64>
|
||||
{
|
||||
type Item = &'a T;
|
||||
type IntoIter = Iter<'a, T>;
|
||||
|
||||
fn into_iter(self) -> Iter<'a, T> {
|
||||
self.iter()
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<T, S, H> IntoIterator for HashSet<T, S>
|
||||
where T: Eq + Hash<H>,
|
||||
S: HashState<Hasher=H>,
|
||||
@ -859,6 +877,20 @@ impl<T, S, H> IntoIterator for HashSet<T, S>
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<T, S, H> IntoIterator for HashSet<T, S>
|
||||
where T: Eq + Hash<H>,
|
||||
S: HashState<Hasher=H>,
|
||||
H: hash::Hasher<Output=u64>
|
||||
{
|
||||
type Item = T;
|
||||
type IntoIter = IntoIter<T>;
|
||||
|
||||
fn into_iter(self) -> IntoIter<T> {
|
||||
self.into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, K> Iterator for Iter<'a, K> {
|
||||
type Item = &'a K;
|
||||
|
Loading…
x
Reference in New Issue
Block a user