rollup merge of #23637: apasel422/iter
This commit is contained in:
commit
ca7f7cf3d3
4 changed files with 33 additions and 1 deletions
|
@ -1804,12 +1804,16 @@ struct TwoBitPositions<'a> {
|
||||||
next_idx: usize
|
next_idx: usize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub struct Union<'a>(TwoBitPositions<'a>);
|
pub struct Union<'a>(TwoBitPositions<'a>);
|
||||||
|
#[derive(Clone)]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub struct Intersection<'a>(Take<TwoBitPositions<'a>>);
|
pub struct Intersection<'a>(Take<TwoBitPositions<'a>>);
|
||||||
|
#[derive(Clone)]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub struct Difference<'a>(TwoBitPositions<'a>);
|
pub struct Difference<'a>(TwoBitPositions<'a>);
|
||||||
|
#[derive(Clone)]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub struct SymmetricDifference<'a>(TwoBitPositions<'a>);
|
pub struct SymmetricDifference<'a>(TwoBitPositions<'a>);
|
||||||
|
|
||||||
|
|
|
@ -832,6 +832,8 @@ impl<A> DoubleEndedIterator for IntoIter<A> {
|
||||||
fn next_back(&mut self) -> Option<A> { self.list.pop_back() }
|
fn next_back(&mut self) -> Option<A> { self.list.pop_back() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<A> ExactSizeIterator for IntoIter<A> {}
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl<A> FromIterator<A> for LinkedList<A> {
|
impl<A> FromIterator<A> for LinkedList<A> {
|
||||||
fn from_iter<T: IntoIterator<Item=A>>(iter: T) -> LinkedList<A> {
|
fn from_iter<T: IntoIterator<Item=A>>(iter: T) -> LinkedList<A> {
|
||||||
|
|
|
@ -556,7 +556,7 @@ impl<T> VecDeque<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Consumes the list into an iterator yielding elements by value.
|
/// Consumes the list into a front-to-back iterator yielding elements by value.
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub fn into_iter(self) -> IntoIter<T> {
|
pub fn into_iter(self) -> IntoIter<T> {
|
||||||
IntoIter {
|
IntoIter {
|
||||||
|
@ -1573,6 +1573,7 @@ impl<'a, T> DoubleEndedIterator for IterMut<'a, T> {
|
||||||
impl<'a, T> ExactSizeIterator for IterMut<'a, T> {}
|
impl<'a, T> ExactSizeIterator for IterMut<'a, T> {}
|
||||||
|
|
||||||
/// A by-value VecDeque iterator
|
/// A by-value VecDeque iterator
|
||||||
|
#[derive(Clone)]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub struct IntoIter<T> {
|
pub struct IntoIter<T> {
|
||||||
inner: VecDeque<T>,
|
inner: VecDeque<T>,
|
||||||
|
|
|
@ -853,6 +853,9 @@ impl<T, S> IntoIterator for HashSet<T, S>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a, K> Clone for Iter<'a, K> {
|
||||||
|
fn clone(&self) -> Iter<'a, K> { Iter { iter: self.iter.clone() } }
|
||||||
|
}
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl<'a, K> Iterator for Iter<'a, K> {
|
impl<'a, K> Iterator for Iter<'a, K> {
|
||||||
type Item = &'a K;
|
type Item = &'a K;
|
||||||
|
@ -889,6 +892,12 @@ impl<'a, K> ExactSizeIterator for Drain<'a, K> {
|
||||||
fn len(&self) -> usize { self.iter.len() }
|
fn len(&self) -> usize { self.iter.len() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a, T, S> Clone for Intersection<'a, T, S> {
|
||||||
|
fn clone(&self) -> Intersection<'a, T, S> {
|
||||||
|
Intersection { iter: self.iter.clone(), ..*self }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl<'a, T, S> Iterator for Intersection<'a, T, S>
|
impl<'a, T, S> Iterator for Intersection<'a, T, S>
|
||||||
where T: Eq + Hash, S: HashState
|
where T: Eq + Hash, S: HashState
|
||||||
|
@ -912,6 +921,12 @@ impl<'a, T, S> Iterator for Intersection<'a, T, S>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a, T, S> Clone for Difference<'a, T, S> {
|
||||||
|
fn clone(&self) -> Difference<'a, T, S> {
|
||||||
|
Difference { iter: self.iter.clone(), ..*self }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl<'a, T, S> Iterator for Difference<'a, T, S>
|
impl<'a, T, S> Iterator for Difference<'a, T, S>
|
||||||
where T: Eq + Hash, S: HashState
|
where T: Eq + Hash, S: HashState
|
||||||
|
@ -935,6 +950,12 @@ impl<'a, T, S> Iterator for Difference<'a, T, S>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a, T, S> Clone for SymmetricDifference<'a, T, S> {
|
||||||
|
fn clone(&self) -> SymmetricDifference<'a, T, S> {
|
||||||
|
SymmetricDifference { iter: self.iter.clone() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl<'a, T, S> Iterator for SymmetricDifference<'a, T, S>
|
impl<'a, T, S> Iterator for SymmetricDifference<'a, T, S>
|
||||||
where T: Eq + Hash, S: HashState
|
where T: Eq + Hash, S: HashState
|
||||||
|
@ -945,6 +966,10 @@ impl<'a, T, S> Iterator for SymmetricDifference<'a, T, S>
|
||||||
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
|
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a, T, S> Clone for Union<'a, T, S> {
|
||||||
|
fn clone(&self) -> Union<'a, T, S> { Union { iter: self.iter.clone() } }
|
||||||
|
}
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl<'a, T, S> Iterator for Union<'a, T, S>
|
impl<'a, T, S> Iterator for Union<'a, T, S>
|
||||||
where T: Eq + Hash, S: HashState
|
where T: Eq + Hash, S: HashState
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue