collections: fix fallout

This commit is contained in:
Jorge Aparicio 2015-01-01 23:15:35 -05:00
parent 8c59ec0488
commit 6b116bedaf
13 changed files with 211 additions and 124 deletions

View File

@ -573,7 +573,9 @@ impl<'a, T> Clone for Iter<'a, T> {
}
#[stable]
impl<'a, T> Iterator<&'a T> for Iter<'a, T> {
impl<'a, T> Iterator for Iter<'a, T> {
type Item = &'a T;
#[inline]
fn next(&mut self) -> Option<&'a T> { self.iter.next() }
@ -582,13 +584,13 @@ impl<'a, T> Iterator<&'a T> for Iter<'a, T> {
}
#[stable]
impl<'a, T> DoubleEndedIterator<&'a T> for Iter<'a, T> {
impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
#[inline]
fn next_back(&mut self) -> Option<&'a T> { self.iter.next_back() }
}
#[stable]
impl<'a, T> ExactSizeIterator<&'a T> for Iter<'a, T> {}
impl<'a, T> ExactSizeIterator for Iter<'a, T> {}
/// An iterator that moves out of a `BinaryHeap`.
pub struct IntoIter<T> {
@ -596,7 +598,9 @@ pub struct IntoIter<T> {
}
#[stable]
impl<T> Iterator<T> for IntoIter<T> {
impl<T> Iterator for IntoIter<T> {
type Item = T;
#[inline]
fn next(&mut self) -> Option<T> { self.iter.next() }
@ -605,13 +609,13 @@ impl<T> Iterator<T> for IntoIter<T> {
}
#[stable]
impl<T> DoubleEndedIterator<T> for IntoIter<T> {
impl<T> DoubleEndedIterator for IntoIter<T> {
#[inline]
fn next_back(&mut self) -> Option<T> { self.iter.next_back() }
}
#[stable]
impl<T> ExactSizeIterator<T> for IntoIter<T> {}
impl<T> ExactSizeIterator for IntoIter<T> {}
/// An iterator that drains a `BinaryHeap`.
pub struct Drain<'a, T: 'a> {
@ -619,7 +623,9 @@ pub struct Drain<'a, T: 'a> {
}
#[stable]
impl<'a, T: 'a> Iterator<T> for Drain<'a, T> {
impl<'a, T: 'a> Iterator for Drain<'a, T> {
type Item = T;
#[inline]
fn next(&mut self) -> Option<T> { self.iter.next() }
@ -628,24 +634,24 @@ impl<'a, T: 'a> Iterator<T> for Drain<'a, T> {
}
#[stable]
impl<'a, T: 'a> DoubleEndedIterator<T> for Drain<'a, T> {
impl<'a, T: 'a> DoubleEndedIterator for Drain<'a, T> {
#[inline]
fn next_back(&mut self) -> Option<T> { self.iter.next_back() }
}
#[stable]
impl<'a, T: 'a> ExactSizeIterator<T> for Drain<'a, T> {}
impl<'a, T: 'a> ExactSizeIterator for Drain<'a, T> {}
#[stable]
impl<T: Ord> FromIterator<T> for BinaryHeap<T> {
fn from_iter<Iter: Iterator<T>>(iter: Iter) -> BinaryHeap<T> {
fn from_iter<Iter: Iterator<Item=T>>(iter: Iter) -> BinaryHeap<T> {
BinaryHeap::from_vec(iter.collect())
}
}
#[stable]
impl<T: Ord> Extend<T> for BinaryHeap<T> {
fn extend<Iter: Iterator<T>>(&mut self, mut iter: Iter) {
fn extend<Iter: Iterator<Item=T>>(&mut self, mut iter: Iter) {
let (lower, _) = iter.size_hint();
self.reserve(lower);

View File

@ -938,7 +938,7 @@ impl Default for Bitv {
#[stable]
impl FromIterator<bool> for Bitv {
fn from_iter<I:Iterator<bool>>(iterator: I) -> Bitv {
fn from_iter<I:Iterator<Item=bool>>(iterator: I) -> Bitv {
let mut ret = Bitv::new();
ret.extend(iterator);
ret
@ -948,7 +948,7 @@ impl FromIterator<bool> for Bitv {
#[stable]
impl Extend<bool> for Bitv {
#[inline]
fn extend<I: Iterator<bool>>(&mut self, mut iterator: I) {
fn extend<I: Iterator<Item=bool>>(&mut self, mut iterator: I) {
let (min, _) = iterator.size_hint();
self.reserve(min);
for element in iterator {
@ -1031,7 +1031,9 @@ pub struct Iter<'a> {
}
#[stable]
impl<'a> Iterator<bool> for Iter<'a> {
impl<'a> Iterator for Iter<'a> {
type Item = bool;
#[inline]
fn next(&mut self) -> Option<bool> {
if self.next_idx != self.end_idx {
@ -1050,7 +1052,7 @@ impl<'a> Iterator<bool> for Iter<'a> {
}
#[stable]
impl<'a> DoubleEndedIterator<bool> for Iter<'a> {
impl<'a> DoubleEndedIterator for Iter<'a> {
#[inline]
fn next_back(&mut self) -> Option<bool> {
if self.next_idx != self.end_idx {
@ -1063,10 +1065,10 @@ impl<'a> DoubleEndedIterator<bool> for Iter<'a> {
}
#[stable]
impl<'a> ExactSizeIterator<bool> for Iter<'a> {}
impl<'a> ExactSizeIterator for Iter<'a> {}
#[stable]
impl<'a> RandomAccessIterator<bool> for Iter<'a> {
impl<'a> RandomAccessIterator for Iter<'a> {
#[inline]
fn indexable(&self) -> uint {
self.end_idx - self.next_idx
@ -1134,7 +1136,7 @@ impl Default for BitvSet {
#[stable]
impl FromIterator<uint> for BitvSet {
fn from_iter<I:Iterator<uint>>(iterator: I) -> BitvSet {
fn from_iter<I:Iterator<Item=uint>>(iterator: I) -> BitvSet {
let mut ret = BitvSet::new();
ret.extend(iterator);
ret
@ -1144,7 +1146,7 @@ impl FromIterator<uint> for BitvSet {
#[stable]
impl Extend<uint> for BitvSet {
#[inline]
fn extend<I: Iterator<uint>>(&mut self, mut iterator: I) {
fn extend<I: Iterator<Item=uint>>(&mut self, mut iterator: I) {
for i in iterator {
self.insert(i);
}
@ -1792,7 +1794,9 @@ pub struct Difference<'a>(TwoBitPositions<'a>);
pub struct SymmetricDifference<'a>(TwoBitPositions<'a>);
#[stable]
impl<'a> Iterator<uint> for SetIter<'a> {
impl<'a> Iterator for SetIter<'a> {
type Item = uint;
fn next(&mut self) -> Option<uint> {
while self.next_idx < self.set.bitv.len() {
let idx = self.next_idx;
@ -1813,7 +1817,9 @@ impl<'a> Iterator<uint> for SetIter<'a> {
}
#[stable]
impl<'a> Iterator<uint> for TwoBitPositions<'a> {
impl<'a> Iterator for TwoBitPositions<'a> {
type Item = uint;
fn next(&mut self) -> Option<uint> {
while self.next_idx < self.set.bitv.len() ||
self.next_idx < self.other.bitv.len() {
@ -1849,25 +1855,33 @@ impl<'a> Iterator<uint> for TwoBitPositions<'a> {
}
#[stable]
impl<'a> Iterator<uint> for Union<'a> {
impl<'a> Iterator for Union<'a> {
type Item = uint;
#[inline] fn next(&mut self) -> Option<uint> { self.0.next() }
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.0.size_hint() }
}
#[stable]
impl<'a> Iterator<uint> for Intersection<'a> {
impl<'a> Iterator for Intersection<'a> {
type Item = uint;
#[inline] fn next(&mut self) -> Option<uint> { self.0.next() }
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.0.size_hint() }
}
#[stable]
impl<'a> Iterator<uint> for Difference<'a> {
impl<'a> Iterator for Difference<'a> {
type Item = uint;
#[inline] fn next(&mut self) -> Option<uint> { self.0.next() }
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.0.size_hint() }
}
#[stable]
impl<'a> Iterator<uint> for SymmetricDifference<'a> {
impl<'a> Iterator for SymmetricDifference<'a> {
type Item = uint;
#[inline] fn next(&mut self) -> Option<uint> { self.0.next() }
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.0.size_hint() }
}

View File

@ -823,7 +823,7 @@ mod stack {
#[stable]
impl<K: Ord, V> FromIterator<(K, V)> for BTreeMap<K, V> {
fn from_iter<T: Iterator<(K, V)>>(iter: T) -> BTreeMap<K, V> {
fn from_iter<T: Iterator<Item=(K, V)>>(iter: T) -> BTreeMap<K, V> {
let mut map = BTreeMap::new();
map.extend(iter);
map
@ -833,7 +833,7 @@ impl<K: Ord, V> FromIterator<(K, V)> for BTreeMap<K, V> {
#[stable]
impl<K: Ord, V> Extend<(K, V)> for BTreeMap<K, V> {
#[inline]
fn extend<T: Iterator<(K, V)>>(&mut self, mut iter: T) {
fn extend<T: Iterator<Item=(K, V)>>(&mut self, mut iter: T) {
for (k, v) in iter {
self.insert(k, v);
}
@ -949,8 +949,11 @@ enum StackOp<T> {
Pop,
}
impl<K, V, E, T: Traverse<E> + DoubleEndedIterator<TraversalItem<K, V, E>>>
Iterator<(K, V)> for AbsIter<T> {
impl<K, V, E, T> Iterator for AbsIter<T> where
T: DoubleEndedIterator + Iterator<Item=TraversalItem<K, V, E>> + Traverse<E>,
{
type Item = (K, V);
// This function is pretty long, but only because there's a lot of cases to consider.
// Our iterator represents two search paths, left and right, to the smallest and largest
// elements we have yet to yield. lca represents the least common ancestor of these two paths,
@ -1015,8 +1018,9 @@ impl<K, V, E, T: Traverse<E> + DoubleEndedIterator<TraversalItem<K, V, E>>>
}
}
impl<K, V, E, T: Traverse<E> + DoubleEndedIterator<TraversalItem<K, V, E>>>
DoubleEndedIterator<(K, V)> for AbsIter<T> {
impl<K, V, E, T> DoubleEndedIterator for AbsIter<T> where
T: DoubleEndedIterator + Iterator<Item=TraversalItem<K, V, E>> + Traverse<E>,
{
// next_back is totally symmetric to next
fn next_back(&mut self) -> Option<(K, V)> {
loop {
@ -1054,64 +1058,75 @@ impl<K, V, E, T: Traverse<E> + DoubleEndedIterator<TraversalItem<K, V, E>>>
}
#[stable]
impl<'a, K, V> Iterator<(&'a K, &'a V)> for Iter<'a, K, V> {
impl<'a, K, V> Iterator for Iter<'a, K, V> {
type Item = (&'a K, &'a V);
fn next(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next() }
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
}
#[stable]
impl<'a, K, V> DoubleEndedIterator<(&'a K, &'a V)> for Iter<'a, K, V> {
impl<'a, K, V> DoubleEndedIterator for Iter<'a, K, V> {
fn next_back(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next_back() }
}
#[stable]
impl<'a, K, V> ExactSizeIterator<(&'a K, &'a V)> for Iter<'a, K, V> {}
impl<'a, K, V> ExactSizeIterator for Iter<'a, K, V> {}
#[stable]
impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> {
impl<'a, K, V> Iterator for IterMut<'a, K, V> {
type Item = (&'a K, &'a mut V);
fn next(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next() }
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
}
#[stable]
impl<'a, K, V> DoubleEndedIterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> {
impl<'a, K, V> DoubleEndedIterator for IterMut<'a, K, V> {
fn next_back(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next_back() }
}
#[stable]
impl<'a, K, V> ExactSizeIterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> {}
impl<'a, K, V> ExactSizeIterator for IterMut<'a, K, V> {}
#[stable]
impl<K, V> Iterator<(K, V)> for IntoIter<K, V> {
impl<K, V> Iterator for IntoIter<K, V> {
type Item = (K, V);
fn next(&mut self) -> Option<(K, V)> { self.inner.next() }
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
}
#[stable]
impl<K, V> DoubleEndedIterator<(K, V)> for IntoIter<K, V> {
impl<K, V> DoubleEndedIterator for IntoIter<K, V> {
fn next_back(&mut self) -> Option<(K, V)> { self.inner.next_back() }
}
#[stable]
impl<K, V> ExactSizeIterator<(K, V)> for IntoIter<K, V> {}
impl<K, V> ExactSizeIterator for IntoIter<K, V> {}
#[stable]
impl<'a, K, V> Iterator<&'a K> for Keys<'a, K, V> {
impl<'a, K, V> Iterator for Keys<'a, K, V> {
type Item = &'a K;
fn next(&mut self) -> Option<(&'a K)> { self.inner.next() }
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
}
#[stable]
impl<'a, K, V> DoubleEndedIterator<&'a K> for Keys<'a, K, V> {
impl<'a, K, V> DoubleEndedIterator for Keys<'a, K, V> {
fn next_back(&mut self) -> Option<(&'a K)> { self.inner.next_back() }
}
#[stable]
impl<'a, K, V> ExactSizeIterator<&'a K> for Keys<'a, K, V> {}
impl<'a, K, V> ExactSizeIterator for Keys<'a, K, V> {}
#[stable]
impl<'a, K, V> Iterator<&'a V> for Values<'a, K, V> {
impl<'a, K, V> Iterator for Values<'a, K, V> {
type Item = &'a V;
fn next(&mut self) -> Option<(&'a V)> { self.inner.next() }
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
}
#[stable]
impl<'a, K, V> DoubleEndedIterator<&'a V> for Values<'a, K, V> {
impl<'a, K, V> DoubleEndedIterator for Values<'a, K, V> {
fn next_back(&mut self) -> Option<(&'a V)> { self.inner.next_back() }
}
#[stable]
impl<'a, K, V> ExactSizeIterator<&'a V> for Values<'a, K, V> {}
impl<'a, K, V> ExactSizeIterator for Values<'a, K, V> {}
impl<'a, K: Ord, V> VacantEntry<'a, K, V> {

View File

@ -210,7 +210,9 @@ impl<T> RawItems<T> {
}
}
impl<T> Iterator<T> for RawItems<T> {
impl<T> Iterator for RawItems<T> {
type Item = T;
fn next(&mut self) -> Option<T> {
if self.head == self.tail {
None
@ -230,7 +232,7 @@ impl<T> Iterator<T> for RawItems<T> {
}
}
impl<T> DoubleEndedIterator<T> for RawItems<T> {
impl<T> DoubleEndedIterator for RawItems<T> {
fn next_back(&mut self) -> Option<T> {
if self.head == self.tail {
None
@ -1321,8 +1323,10 @@ trait TraversalImpl<K, V, E> {
/// as no deallocation needs to be done.
struct ElemsAndEdges<Elems, Edges>(Elems, Edges);
impl<K, V, E, Elems: DoubleEndedIterator<(K, V)>, Edges: DoubleEndedIterator<E>>
TraversalImpl<K, V, E> for ElemsAndEdges<Elems, Edges> {
impl<K, V, E, Elems: DoubleEndedIterator, Edges: DoubleEndedIterator>
TraversalImpl<K, V, E> for ElemsAndEdges<Elems, Edges>
where Elems : Iterator<Item=(K, V)>, Edges : Iterator<Item=E>
{
fn next_kv(&mut self) -> Option<(K, V)> { self.0.next() }
fn next_kv_back(&mut self) -> Option<(K, V)> { self.0.next_back() }
@ -1414,8 +1418,8 @@ pub type MutTraversal<'a, K, V> = AbsTraversal<ElemsAndEdges<Zip<slice::Iter<'a,
pub type MoveTraversal<K, V> = AbsTraversal<MoveTraversalImpl<K, V>>;
impl<K, V, E, Impl: TraversalImpl<K, V, E>>
Iterator<TraversalItem<K, V, E>> for AbsTraversal<Impl> {
impl<K, V, E, Impl: TraversalImpl<K, V, E>> Iterator for AbsTraversal<Impl> {
type Item = TraversalItem<K, V, E>;
fn next(&mut self) -> Option<TraversalItem<K, V, E>> {
let head_is_edge = self.head_is_edge;
@ -1429,9 +1433,7 @@ impl<K, V, E, Impl: TraversalImpl<K, V, E>>
}
}
impl<K, V, E, Impl: TraversalImpl<K, V, E>>
DoubleEndedIterator<TraversalItem<K, V, E>> for AbsTraversal<Impl> {
impl<K, V, E, Impl: TraversalImpl<K, V, E>> DoubleEndedIterator for AbsTraversal<Impl> {
fn next_back(&mut self) -> Option<TraversalItem<K, V, E>> {
let tail_is_edge = self.tail_is_edge;
self.tail_is_edge = !tail_is_edge;

View File

@ -436,7 +436,7 @@ impl<T: Ord> BTreeSet<T> {
#[stable]
impl<T: Ord> FromIterator<T> for BTreeSet<T> {
fn from_iter<Iter: Iterator<T>>(iter: Iter) -> BTreeSet<T> {
fn from_iter<Iter: Iterator<Item=T>>(iter: Iter) -> BTreeSet<T> {
let mut set = BTreeSet::new();
set.extend(iter);
set
@ -446,7 +446,7 @@ impl<T: Ord> FromIterator<T> for BTreeSet<T> {
#[stable]
impl<T: Ord> Extend<T> for BTreeSet<T> {
#[inline]
fn extend<Iter: Iterator<T>>(&mut self, mut iter: Iter) {
fn extend<Iter: Iterator<Item=T>>(&mut self, mut iter: Iter) {
for elem in iter {
self.insert(elem);
}
@ -560,28 +560,33 @@ impl<T: Show> Show for BTreeSet<T> {
}
#[stable]
impl<'a, T> Iterator<&'a T> for Iter<'a, T> {
impl<'a, T> Iterator for Iter<'a, T> {
type Item = &'a T;
fn next(&mut self) -> Option<&'a T> { self.iter.next() }
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
}
#[stable]
impl<'a, T> DoubleEndedIterator<&'a T> for Iter<'a, T> {
impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
fn next_back(&mut self) -> Option<&'a T> { self.iter.next_back() }
}
#[stable]
impl<'a, T> ExactSizeIterator<&'a T> for Iter<'a, T> {}
impl<'a, T> ExactSizeIterator for Iter<'a, T> {}
#[stable]
impl<T> Iterator<T> for IntoIter<T> {
impl<T> Iterator for IntoIter<T> {
type Item = T;
fn next(&mut self) -> Option<T> { self.iter.next() }
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
}
#[stable]
impl<T> DoubleEndedIterator<T> for IntoIter<T> {
impl<T> DoubleEndedIterator for IntoIter<T> {
fn next_back(&mut self) -> Option<T> { self.iter.next_back() }
}
#[stable]
impl<T> ExactSizeIterator<T> for IntoIter<T> {}
impl<T> ExactSizeIterator for IntoIter<T> {}
/// Compare `x` and `y`, but return `short` if x is None and `long` if y is None
fn cmp_opt<T: Ord>(x: Option<&T>, y: Option<&T>,
@ -594,7 +599,9 @@ fn cmp_opt<T: Ord>(x: Option<&T>, y: Option<&T>,
}
#[stable]
impl<'a, T: Ord> Iterator<&'a T> for Difference<'a, T> {
impl<'a, T: Ord> Iterator for Difference<'a, T> {
type Item = &'a T;
fn next(&mut self) -> Option<&'a T> {
loop {
match cmp_opt(self.a.peek(), self.b.peek(), Less, Less) {
@ -607,7 +614,9 @@ impl<'a, T: Ord> Iterator<&'a T> for Difference<'a, T> {
}
#[stable]
impl<'a, T: Ord> Iterator<&'a T> for SymmetricDifference<'a, T> {
impl<'a, T: Ord> Iterator for SymmetricDifference<'a, T> {
type Item = &'a T;
fn next(&mut self) -> Option<&'a T> {
loop {
match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) {
@ -620,7 +629,9 @@ impl<'a, T: Ord> Iterator<&'a T> for SymmetricDifference<'a, T> {
}
#[stable]
impl<'a, T: Ord> Iterator<&'a T> for Intersection<'a, T> {
impl<'a, T: Ord> Iterator for Intersection<'a, T> {
type Item = &'a T;
fn next(&mut self) -> Option<&'a T> {
loop {
let o_cmp = match (self.a.peek(), self.b.peek()) {
@ -639,7 +650,9 @@ impl<'a, T: Ord> Iterator<&'a T> for Intersection<'a, T> {
}
#[stable]
impl<'a, T: Ord> Iterator<&'a T> for Union<'a, T> {
impl<'a, T: Ord> Iterator for Union<'a, T> {
type Item = &'a T;
fn next(&mut self) -> Option<&'a T> {
loop {
match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) {

View File

@ -508,7 +508,9 @@ impl<T> Drop for DList<T> {
}
#[stable]
impl<'a, A> Iterator<&'a A> for Iter<'a, A> {
impl<'a, A> Iterator for Iter<'a, A> {
type Item = &'a A;
#[inline]
fn next(&mut self) -> Option<&'a A> {
if self.nelem == 0 {
@ -528,7 +530,7 @@ impl<'a, A> Iterator<&'a A> for Iter<'a, A> {
}
#[stable]
impl<'a, A> DoubleEndedIterator<&'a A> for Iter<'a, A> {
impl<'a, A> DoubleEndedIterator for Iter<'a, A> {
#[inline]
fn next_back(&mut self) -> Option<&'a A> {
if self.nelem == 0 {
@ -543,10 +545,11 @@ impl<'a, A> DoubleEndedIterator<&'a A> for Iter<'a, A> {
}
#[stable]
impl<'a, A> ExactSizeIterator<&'a A> for Iter<'a, A> {}
impl<'a, A> ExactSizeIterator for Iter<'a, A> {}
#[stable]
impl<'a, A> Iterator<&'a mut A> for IterMut<'a, A> {
impl<'a, A> Iterator for IterMut<'a, A> {
type Item = &'a mut A;
#[inline]
fn next(&mut self) -> Option<&'a mut A> {
if self.nelem == 0 {
@ -569,7 +572,7 @@ impl<'a, A> Iterator<&'a mut A> for IterMut<'a, A> {
}
#[stable]
impl<'a, A> DoubleEndedIterator<&'a mut A> for IterMut<'a, A> {
impl<'a, A> DoubleEndedIterator for IterMut<'a, A> {
#[inline]
fn next_back(&mut self) -> Option<&'a mut A> {
if self.nelem == 0 {
@ -584,7 +587,7 @@ impl<'a, A> DoubleEndedIterator<&'a mut A> for IterMut<'a, A> {
}
#[stable]
impl<'a, A> ExactSizeIterator<&'a mut A> for IterMut<'a, A> {}
impl<'a, A> ExactSizeIterator for IterMut<'a, A> {}
/// Allows mutating a `DList` while iterating.
#[deprecated = "Trait is deprecated, use inherent methods on the iterator instead"]
@ -676,7 +679,9 @@ impl<'a, A> IterMut<'a, A> {
}
#[stable]
impl<A> Iterator<A> for IntoIter<A> {
impl<A> Iterator for IntoIter<A> {
type Item = A;
#[inline]
fn next(&mut self) -> Option<A> { self.list.pop_front() }
@ -687,14 +692,14 @@ impl<A> Iterator<A> for IntoIter<A> {
}
#[stable]
impl<A> DoubleEndedIterator<A> for IntoIter<A> {
impl<A> DoubleEndedIterator for IntoIter<A> {
#[inline]
fn next_back(&mut self) -> Option<A> { self.list.pop_back() }
}
#[stable]
impl<A> FromIterator<A> for DList<A> {
fn from_iter<T: Iterator<A>>(iterator: T) -> DList<A> {
fn from_iter<T: Iterator<Item=A>>(iterator: T) -> DList<A> {
let mut ret = DList::new();
ret.extend(iterator);
ret
@ -703,7 +708,7 @@ impl<A> FromIterator<A> for DList<A> {
#[stable]
impl<A> Extend<A> for DList<A> {
fn extend<T: Iterator<A>>(&mut self, mut iterator: T) {
fn extend<T: Iterator<Item=A>>(&mut self, mut iterator: T) {
for elt in iterator { self.push_back(elt); }
}
}

View File

@ -231,7 +231,9 @@ impl<E:CLike> Iter<E> {
}
}
impl<E:CLike> Iterator<E> for Iter<E> {
impl<E:CLike> Iterator for Iter<E> {
type Item = E;
fn next(&mut self) -> Option<E> {
if self.bits == 0 {
return None;
@ -254,7 +256,7 @@ impl<E:CLike> Iterator<E> for Iter<E> {
}
impl<E:CLike> FromIterator<E> for EnumSet<E> {
fn from_iter<I:Iterator<E>>(iterator: I) -> EnumSet<E> {
fn from_iter<I:Iterator<Item=E>>(iterator: I) -> EnumSet<E> {
let mut ret = EnumSet::new();
ret.extend(iterator);
ret
@ -262,7 +264,7 @@ impl<E:CLike> FromIterator<E> for EnumSet<E> {
}
impl<E:CLike> Extend<E> for EnumSet<E> {
fn extend<I: Iterator<E>>(&mut self, mut iterator: I) {
fn extend<I: Iterator<Item=E>>(&mut self, mut iterator: I) {
for element in iterator {
self.insert(element);
}

View File

@ -1151,7 +1151,9 @@ impl<'a, T> Clone for Iter<'a, T> {
}
#[stable]
impl<'a, T> Iterator<&'a T> for Iter<'a, T> {
impl<'a, T> Iterator for Iter<'a, T> {
type Item = &'a T;
#[inline]
fn next(&mut self) -> Option<&'a T> {
if self.tail == self.head {
@ -1170,7 +1172,7 @@ impl<'a, T> Iterator<&'a T> for Iter<'a, T> {
}
#[stable]
impl<'a, T> DoubleEndedIterator<&'a T> for Iter<'a, T> {
impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
#[inline]
fn next_back(&mut self) -> Option<&'a T> {
if self.tail == self.head {
@ -1182,10 +1184,10 @@ impl<'a, T> DoubleEndedIterator<&'a T> for Iter<'a, T> {
}
#[stable]
impl<'a, T> ExactSizeIterator<&'a T> for Iter<'a, T> {}
impl<'a, T> ExactSizeIterator for Iter<'a, T> {}
#[stable]
impl<'a, T> RandomAccessIterator<&'a T> for Iter<'a, T> {
impl<'a, T> RandomAccessIterator for Iter<'a, T> {
#[inline]
fn indexable(&self) -> uint {
let (len, _) = self.size_hint();
@ -1217,7 +1219,9 @@ pub struct IterMut<'a, T:'a> {
}
#[stable]
impl<'a, T> Iterator<&'a mut T> for IterMut<'a, T> {
impl<'a, T> Iterator for IterMut<'a, T> {
type Item = &'a mut T;
#[inline]
fn next(&mut self) -> Option<&'a mut T> {
if self.tail == self.head {
@ -1239,7 +1243,7 @@ impl<'a, T> Iterator<&'a mut T> for IterMut<'a, T> {
}
#[stable]
impl<'a, T> DoubleEndedIterator<&'a mut T> for IterMut<'a, T> {
impl<'a, T> DoubleEndedIterator for IterMut<'a, T> {
#[inline]
fn next_back(&mut self) -> Option<&'a mut T> {
if self.tail == self.head {
@ -1254,7 +1258,7 @@ impl<'a, T> DoubleEndedIterator<&'a mut T> for IterMut<'a, T> {
}
#[stable]
impl<'a, T> ExactSizeIterator<&'a mut T> for IterMut<'a, T> {}
impl<'a, T> ExactSizeIterator for IterMut<'a, T> {}
/// A by-value RingBuf iterator
#[stable]
@ -1263,7 +1267,9 @@ pub struct IntoIter<T> {
}
#[stable]
impl<T> Iterator<T> for IntoIter<T> {
impl<T> Iterator for IntoIter<T> {
type Item = T;
#[inline]
fn next(&mut self) -> Option<T> {
self.inner.pop_front()
@ -1277,7 +1283,7 @@ impl<T> Iterator<T> for IntoIter<T> {
}
#[stable]
impl<T> DoubleEndedIterator<T> for IntoIter<T> {
impl<T> DoubleEndedIterator for IntoIter<T> {
#[inline]
fn next_back(&mut self) -> Option<T> {
self.inner.pop_back()
@ -1285,7 +1291,7 @@ impl<T> DoubleEndedIterator<T> for IntoIter<T> {
}
#[stable]
impl<T> ExactSizeIterator<T> for IntoIter<T> {}
impl<T> ExactSizeIterator for IntoIter<T> {}
/// A draining RingBuf iterator
#[unstable = "matches collection reform specification, waiting for dust to settle"]
@ -1304,7 +1310,9 @@ impl<'a, T: 'a> Drop for Drain<'a, T> {
}
#[stable]
impl<'a, T: 'a> Iterator<T> for Drain<'a, T> {
impl<'a, T: 'a> Iterator for Drain<'a, T> {
type Item = T;
#[inline]
fn next(&mut self) -> Option<T> {
self.inner.pop_front()
@ -1318,7 +1326,7 @@ impl<'a, T: 'a> Iterator<T> for Drain<'a, T> {
}
#[stable]
impl<'a, T: 'a> DoubleEndedIterator<T> for Drain<'a, T> {
impl<'a, T: 'a> DoubleEndedIterator for Drain<'a, T> {
#[inline]
fn next_back(&mut self) -> Option<T> {
self.inner.pop_back()
@ -1326,7 +1334,7 @@ impl<'a, T: 'a> DoubleEndedIterator<T> for Drain<'a, T> {
}
#[stable]
impl<'a, T: 'a> ExactSizeIterator<T> for Drain<'a, T> {}
impl<'a, T: 'a> ExactSizeIterator for Drain<'a, T> {}
#[stable]
impl<A: PartialEq> PartialEq for RingBuf<A> {
@ -1382,7 +1390,7 @@ impl<A> IndexMut<uint, A> for RingBuf<A> {
#[stable]
impl<A> FromIterator<A> for RingBuf<A> {
fn from_iter<T: Iterator<A>>(iterator: T) -> RingBuf<A> {
fn from_iter<T: Iterator<Item=A>>(iterator: T) -> RingBuf<A> {
let (lower, _) = iterator.size_hint();
let mut deq = RingBuf::with_capacity(lower);
deq.extend(iterator);
@ -1392,7 +1400,7 @@ impl<A> FromIterator<A> for RingBuf<A> {
#[stable]
impl<A> Extend<A> for RingBuf<A> {
fn extend<T: Iterator<A>>(&mut self, mut iterator: T) {
fn extend<T: Iterator<Item=A>>(&mut self, mut iterator: T) {
for elt in iterator {
self.push_back(elt);
}

View File

@ -1140,7 +1140,9 @@ struct SizeDirection {
dir: Direction,
}
impl Iterator<(uint, uint)> for ElementSwaps {
impl Iterator for ElementSwaps {
type Item = (uint, uint);
#[inline]
fn next(&mut self) -> Option<(uint, uint)> {
fn new_pos(i: uint, s: Direction) -> uint {
@ -1207,7 +1209,9 @@ pub struct Permutations<T> {
}
#[unstable = "trait is unstable"]
impl<T: Clone> Iterator<Vec<T>> for Permutations<T> {
impl<T: Clone> Iterator for Permutations<T> {
type Item = Vec<T>;
#[inline]
fn next(&mut self) -> Option<Vec<T>> {
match self.swaps.next() {

View File

@ -181,7 +181,9 @@ pub struct Decompositions<'a> {
sorted: bool
}
impl<'a> Iterator<char> for Decompositions<'a> {
impl<'a> Iterator for Decompositions<'a> {
type Item = char;
#[inline]
fn next(&mut self) -> Option<char> {
match self.buffer.first() {
@ -268,7 +270,9 @@ pub struct Recompositions<'a> {
last_ccc: Option<u8>
}
impl<'a> Iterator<char> for Recompositions<'a> {
impl<'a> Iterator for Recompositions<'a> {
type Item = char;
#[inline]
fn next(&mut self) -> Option<char> {
loop {
@ -357,7 +361,9 @@ pub struct Utf16Units<'a> {
encoder: Utf16Encoder<Chars<'a>>
}
impl<'a> Iterator<u16> for Utf16Units<'a> {
impl<'a> Iterator for Utf16Units<'a> {
type Item = u16;
#[inline]
fn next(&mut self) -> Option<u16> { self.encoder.next() }

View File

@ -781,7 +781,7 @@ impl fmt::Show for FromUtf16Error {
#[experimental = "waiting on FromIterator stabilization"]
impl FromIterator<char> for String {
fn from_iter<I:Iterator<char>>(iterator: I) -> String {
fn from_iter<I:Iterator<Item=char>>(iterator: I) -> String {
let mut buf = String::new();
buf.extend(iterator);
buf
@ -790,7 +790,7 @@ impl FromIterator<char> for String {
#[experimental = "waiting on FromIterator stabilization"]
impl<'a> FromIterator<&'a str> for String {
fn from_iter<I:Iterator<&'a str>>(iterator: I) -> String {
fn from_iter<I:Iterator<Item=&'a str>>(iterator: I) -> String {
let mut buf = String::new();
buf.extend(iterator);
buf
@ -799,7 +799,7 @@ impl<'a> FromIterator<&'a str> for String {
#[experimental = "waiting on Extend stabilization"]
impl Extend<char> for String {
fn extend<I:Iterator<char>>(&mut self, mut iterator: I) {
fn extend<I:Iterator<Item=char>>(&mut self, mut iterator: I) {
let (lower_bound, _) = iterator.size_hint();
self.reserve(lower_bound);
for ch in iterator {
@ -810,7 +810,7 @@ impl Extend<char> for String {
#[experimental = "waiting on Extend stabilization"]
impl<'a> Extend<&'a str> for String {
fn extend<I: Iterator<&'a str>>(&mut self, mut iterator: I) {
fn extend<I: Iterator<Item=&'a str>>(&mut self, mut iterator: I) {
// A guess that at least one byte per iterator element will be needed.
let (lower_bound, _) = iterator.size_hint();
self.reserve(lower_bound);

View File

@ -1164,7 +1164,7 @@ impl<T: PartialEq> Vec<T> {
/// Deprecated: use `unzip` directly on the iterator instead.
#[deprecated = "use unzip directly on the iterator instead"]
pub fn unzip<T, U, V: Iterator<(T, U)>>(iter: V) -> (Vec<T>, Vec<U>) {
pub fn unzip<T, U, V: Iterator<Item=(T, U)>>(iter: V) -> (Vec<T>, Vec<U>) {
iter.unzip()
}
@ -1317,7 +1317,7 @@ impl<T> ops::DerefMut for Vec<T> {
#[experimental = "waiting on FromIterator stability"]
impl<T> FromIterator<T> for Vec<T> {
#[inline]
fn from_iter<I:Iterator<T>>(mut iterator: I) -> Vec<T> {
fn from_iter<I:Iterator<Item=T>>(mut iterator: I) -> Vec<T> {
let (lower, _) = iterator.size_hint();
let mut vector = Vec::with_capacity(lower);
for element in iterator {
@ -1330,7 +1330,7 @@ impl<T> FromIterator<T> for Vec<T> {
#[experimental = "waiting on Extend stability"]
impl<T> Extend<T> for Vec<T> {
#[inline]
fn extend<I: Iterator<T>>(&mut self, mut iterator: I) {
fn extend<I: Iterator<Item=T>>(&mut self, mut iterator: I) {
let (lower, _) = iterator.size_hint();
self.reserve(lower);
for element in iterator {
@ -1506,7 +1506,7 @@ impl<'a> fmt::Writer for Vec<u8> {
pub type CowVec<'a, T> = Cow<'a, Vec<T>, [T]>;
impl<'a, T> FromIterator<T> for CowVec<'a, T> where T: Clone {
fn from_iter<I: Iterator<T>>(it: I) -> CowVec<'a, T> {
fn from_iter<I: Iterator<Item=T>>(it: I) -> CowVec<'a, T> {
Cow::Owned(FromIterator::from_iter(it))
}
}
@ -1557,7 +1557,9 @@ impl<T> IntoIter<T> {
pub fn unwrap(self) -> Vec<T> { self.into_inner() }
}
impl<T> Iterator<T> for IntoIter<T> {
impl<T> Iterator for IntoIter<T> {
type Item = T;
#[inline]
fn next<'a>(&'a mut self) -> Option<T> {
unsafe {
@ -1591,7 +1593,7 @@ impl<T> Iterator<T> for IntoIter<T> {
}
}
impl<T> DoubleEndedIterator<T> for IntoIter<T> {
impl<T> DoubleEndedIterator for IntoIter<T> {
#[inline]
fn next_back<'a>(&'a mut self) -> Option<T> {
unsafe {
@ -1614,7 +1616,7 @@ impl<T> DoubleEndedIterator<T> for IntoIter<T> {
}
}
impl<T> ExactSizeIterator<T> for IntoIter<T> {}
impl<T> ExactSizeIterator for IntoIter<T> {}
#[unsafe_destructor]
impl<T> Drop for IntoIter<T> {
@ -1638,7 +1640,9 @@ pub struct Drain<'a, T> {
marker: ContravariantLifetime<'a>,
}
impl<'a, T> Iterator<T> for Drain<'a, T> {
impl<'a, T> Iterator for Drain<'a, T> {
type Item = T;
#[inline]
fn next(&mut self) -> Option<T> {
unsafe {
@ -1672,7 +1676,7 @@ impl<'a, T> Iterator<T> for Drain<'a, T> {
}
}
impl<'a, T> DoubleEndedIterator<T> for Drain<'a, T> {
impl<'a, T> DoubleEndedIterator for Drain<'a, T> {
#[inline]
fn next_back(&mut self) -> Option<T> {
unsafe {
@ -1695,7 +1699,7 @@ impl<'a, T> DoubleEndedIterator<T> for Drain<'a, T> {
}
}
impl<'a, T> ExactSizeIterator<T> for Drain<'a, T> {}
impl<'a, T> ExactSizeIterator for Drain<'a, T> {}
#[unsafe_destructor]
impl<'a, T> Drop for Drain<'a, T> {

View File

@ -546,7 +546,7 @@ impl<V: fmt::Show> fmt::Show for VecMap<V> {
#[stable]
impl<V> FromIterator<(uint, V)> for VecMap<V> {
fn from_iter<Iter: Iterator<(uint, V)>>(iter: Iter) -> VecMap<V> {
fn from_iter<Iter: Iterator<Item=(uint, V)>>(iter: Iter) -> VecMap<V> {
let mut map = VecMap::new();
map.extend(iter);
map
@ -555,7 +555,7 @@ impl<V> FromIterator<(uint, V)> for VecMap<V> {
#[stable]
impl<V> Extend<(uint, V)> for VecMap<V> {
fn extend<Iter: Iterator<(uint, V)>>(&mut self, mut iter: Iter) {
fn extend<Iter: Iterator<Item=(uint, V)>>(&mut self, mut iter: Iter) {
for (k, v) in iter {
self.insert(k, v);
}
@ -581,7 +581,9 @@ impl<V> IndexMut<uint, V> for VecMap<V> {
macro_rules! iterator {
(impl $name:ident -> $elem:ty, $($getter:ident),+) => {
#[stable]
impl<'a, V> Iterator<$elem> for $name<'a, V> {
impl<'a, V> Iterator for $name<'a, V> {
type Item = $elem;
#[inline]
fn next(&mut self) -> Option<$elem> {
while self.front < self.back {
@ -614,7 +616,7 @@ macro_rules! iterator {
macro_rules! double_ended_iterator {
(impl $name:ident -> $elem:ty, $($getter:ident),+) => {
#[stable]
impl<'a, V> DoubleEndedIterator<$elem> for $name<'a, V> {
impl<'a, V> DoubleEndedIterator for $name<'a, V> {
#[inline]
fn next_back(&mut self) -> Option<$elem> {
while self.front < self.back {
@ -713,32 +715,38 @@ pub struct IntoIter<V> {
}
#[stable]
impl<'a, V> Iterator<uint> for Keys<'a, V> {
impl<'a, V> Iterator for Keys<'a, V> {
type Item = uint;
fn next(&mut self) -> Option<uint> { self.iter.next() }
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
}
#[stable]
impl<'a, V> DoubleEndedIterator<uint> for Keys<'a, V> {
impl<'a, V> DoubleEndedIterator for Keys<'a, V> {
fn next_back(&mut self) -> Option<uint> { self.iter.next_back() }
}
#[stable]
impl<'a, V> Iterator<&'a V> for Values<'a, V> {
impl<'a, V> Iterator for Values<'a, V> {
type Item = &'a V;
fn next(&mut self) -> Option<(&'a V)> { self.iter.next() }
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
}
#[stable]
impl<'a, V> DoubleEndedIterator<&'a V> for Values<'a, V> {
impl<'a, V> DoubleEndedIterator for Values<'a, V> {
fn next_back(&mut self) -> Option<(&'a V)> { self.iter.next_back() }
}
#[stable]
impl<V> Iterator<(uint, V)> for IntoIter<V> {
impl<V> Iterator for IntoIter<V> {
type Item = (uint, V);
fn next(&mut self) -> Option<(uint, V)> { self.iter.next() }
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
}
#[stable]
impl<V> DoubleEndedIterator<(uint, V)> for IntoIter<V> {
impl<V> DoubleEndedIterator for IntoIter<V> {
fn next_back(&mut self) -> Option<(uint, V)> { self.iter.next_back() }
}