Added missing renames:
libcollections: AbsEntries -> AbsIter, Entries -> Iter, MoveEntries -> IntoIter, MutEntries -> IterMut DifferenceItems -> Difference, SymDifferenceItems -> SymmetricDifference, IntersectionItems -> Intersection, UnionItems -> Union libstd/hash/{table, map}: Entries -> Iter, MoveItems -> IntoIter, MutEntries -> IterMut Also a [breaking-change].
This commit is contained in:
parent
f8cfd2480b
commit
22050e3ed4
@ -240,7 +240,8 @@ impl<T: Ord> BinaryHeap<T> {
|
||||
/// ```
|
||||
#[unstable = "matches collection reform specification, waiting for dust to settle"]
|
||||
pub fn iter(&self) -> Iter<T> {
|
||||
Iter { iter: self.data.iter() } }
|
||||
Iter { iter: self.data.iter() }
|
||||
}
|
||||
|
||||
/// Creates a consuming iterator, that is, one that moves each value out of
|
||||
/// the binary heap in arbitrary order. The binary heap cannot be used
|
||||
|
@ -88,7 +88,7 @@ pub struct BTreeMap<K, V> {
|
||||
}
|
||||
|
||||
/// An abstract base over-which all other BTree iterators are built.
|
||||
struct AbsEntries<T> {
|
||||
struct AbsIter<T> {
|
||||
lca: T,
|
||||
left: RingBuf<T>,
|
||||
right: RingBuf<T>,
|
||||
@ -96,28 +96,28 @@ struct AbsEntries<T> {
|
||||
}
|
||||
|
||||
/// An iterator over a BTreeMap's entries.
|
||||
pub struct Entries<'a, K: 'a, V: 'a> {
|
||||
inner: AbsEntries<Traversal<'a, K, V>>
|
||||
pub struct Iter<'a, K: 'a, V: 'a> {
|
||||
inner: AbsIter<Traversal<'a, K, V>>
|
||||
}
|
||||
|
||||
/// A mutable iterator over a BTreeMap's entries.
|
||||
pub struct MutEntries<'a, K: 'a, V: 'a> {
|
||||
inner: AbsEntries<MutTraversal<'a, K, V>>
|
||||
pub struct IterMut<'a, K: 'a, V: 'a> {
|
||||
inner: AbsIter<MutTraversal<'a, K, V>>
|
||||
}
|
||||
|
||||
/// An owning iterator over a BTreeMap's entries.
|
||||
pub struct MoveEntries<K, V> {
|
||||
inner: AbsEntries<MoveTraversal<K, V>>
|
||||
pub struct IntoIter<K, V> {
|
||||
inner: AbsIter<MoveTraversal<K, V>>
|
||||
}
|
||||
|
||||
/// An iterator over a BTreeMap's keys.
|
||||
pub struct Keys<'a, K: 'a, V: 'a> {
|
||||
inner: Map<(&'a K, &'a V), &'a K, Entries<'a, K, V>, fn((&'a K, &'a V)) -> &'a K>
|
||||
inner: Map<(&'a K, &'a V), &'a K, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a K>
|
||||
}
|
||||
|
||||
/// An iterator over a BTreeMap's values.
|
||||
pub struct Values<'a, K: 'a, V: 'a> {
|
||||
inner: Map<(&'a K, &'a V), &'a V, Entries<'a, K, V>, fn((&'a K, &'a V)) -> &'a V>
|
||||
inner: Map<(&'a K, &'a V), &'a V, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a V>
|
||||
}
|
||||
|
||||
/// A view into a single entry in a map, which may either be vacant or occupied.
|
||||
@ -929,7 +929,7 @@ enum StackOp<T> {
|
||||
}
|
||||
|
||||
impl<K, V, E, T: Traverse<E> + DoubleEndedIterator<TraversalItem<K, V, E>>>
|
||||
Iterator<(K, V)> for AbsEntries<T> {
|
||||
Iterator<(K, V)> for AbsIter<T> {
|
||||
// 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,
|
||||
@ -995,7 +995,7 @@ 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 AbsEntries<T> {
|
||||
DoubleEndedIterator<(K, V)> for AbsIter<T> {
|
||||
// next_back is totally symmetric to next
|
||||
fn next_back(&mut self) -> Option<(K, V)> {
|
||||
loop {
|
||||
@ -1032,34 +1032,34 @@ impl<K, V, E, T: Traverse<E> + DoubleEndedIterator<TraversalItem<K, V, E>>>
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, K, V> Iterator<(&'a K, &'a V)> for Entries<'a, K, V> {
|
||||
impl<'a, K, V> Iterator<(&'a K, &'a V)> for Iter<'a, K, V> {
|
||||
fn next(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next() }
|
||||
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
|
||||
}
|
||||
impl<'a, K, V> DoubleEndedIterator<(&'a K, &'a V)> for Entries<'a, K, V> {
|
||||
impl<'a, K, V> DoubleEndedIterator<(&'a K, &'a V)> for Iter<'a, K, V> {
|
||||
fn next_back(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next_back() }
|
||||
}
|
||||
impl<'a, K, V> ExactSizeIterator<(&'a K, &'a V)> for Entries<'a, K, V> {}
|
||||
impl<'a, K, V> ExactSizeIterator<(&'a K, &'a V)> for Iter<'a, K, V> {}
|
||||
|
||||
|
||||
impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> {
|
||||
impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for IterMut<'a, K, 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() }
|
||||
}
|
||||
impl<'a, K, V> DoubleEndedIterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> {
|
||||
impl<'a, K, V> DoubleEndedIterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> {
|
||||
fn next_back(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next_back() }
|
||||
}
|
||||
impl<'a, K, V> ExactSizeIterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> {}
|
||||
impl<'a, K, V> ExactSizeIterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> {}
|
||||
|
||||
|
||||
impl<K, V> Iterator<(K, V)> for MoveEntries<K, V> {
|
||||
impl<K, V> Iterator<(K, V)> for IntoIter<K, V> {
|
||||
fn next(&mut self) -> Option<(K, V)> { self.inner.next() }
|
||||
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
|
||||
}
|
||||
impl<K, V> DoubleEndedIterator<(K, V)> for MoveEntries<K, V> {
|
||||
impl<K, V> DoubleEndedIterator<(K, V)> for IntoIter<K, V> {
|
||||
fn next_back(&mut self) -> Option<(K, V)> { self.inner.next_back() }
|
||||
}
|
||||
impl<K, V> ExactSizeIterator<(K, V)> for MoveEntries<K, V> {}
|
||||
impl<K, V> ExactSizeIterator<(K, V)> for IntoIter<K, V> {}
|
||||
|
||||
|
||||
impl<'a, K, V> Iterator<&'a K> for Keys<'a, K, V> {
|
||||
@ -1140,10 +1140,10 @@ impl<K, V> BTreeMap<K, V> {
|
||||
/// assert_eq!((*first_key, *first_value), (1u, "a"));
|
||||
/// ```
|
||||
#[unstable = "matches collection reform specification, waiting for dust to settle"]
|
||||
pub fn iter<'a>(&'a self) -> Entries<'a, K, V> {
|
||||
pub fn iter<'a>(&'a self) -> Iter<'a, K, V> {
|
||||
let len = self.len();
|
||||
Entries {
|
||||
inner: AbsEntries {
|
||||
Iter {
|
||||
inner: AbsIter {
|
||||
lca: Traverse::traverse(&self.root),
|
||||
left: RingBuf::new(),
|
||||
right: RingBuf::new(),
|
||||
@ -1172,10 +1172,10 @@ impl<K, V> BTreeMap<K, V> {
|
||||
/// }
|
||||
/// ```
|
||||
#[unstable = "matches collection reform specification, waiting for dust to settle"]
|
||||
pub fn iter_mut<'a>(&'a mut self) -> MutEntries<'a, K, V> {
|
||||
pub fn iter_mut<'a>(&'a mut self) -> IterMut<'a, K, V> {
|
||||
let len = self.len();
|
||||
MutEntries {
|
||||
inner: AbsEntries {
|
||||
IterMut {
|
||||
inner: AbsIter {
|
||||
lca: Traverse::traverse(&mut self.root),
|
||||
left: RingBuf::new(),
|
||||
right: RingBuf::new(),
|
||||
@ -1201,10 +1201,10 @@ impl<K, V> BTreeMap<K, V> {
|
||||
/// }
|
||||
/// ```
|
||||
#[unstable = "matches collection reform specification, waiting for dust to settle"]
|
||||
pub fn into_iter(self) -> MoveEntries<K, V> {
|
||||
pub fn into_iter(self) -> IntoIter<K, V> {
|
||||
let len = self.len();
|
||||
MoveEntries {
|
||||
inner: AbsEntries {
|
||||
IntoIter {
|
||||
inner: AbsIter {
|
||||
lca: Traverse::traverse(self.root),
|
||||
left: RingBuf::new(),
|
||||
right: RingBuf::new(),
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
use core::prelude::*;
|
||||
|
||||
use btree_map::{BTreeMap, Keys, MoveEntries};
|
||||
use btree_map::{BTreeMap, Keys};
|
||||
use std::hash::Hash;
|
||||
use core::borrow::BorrowFrom;
|
||||
use core::default::Default;
|
||||
@ -39,29 +39,29 @@ pub struct Iter<'a, T: 'a> {
|
||||
|
||||
/// An owning iterator over a BTreeSet's items.
|
||||
pub struct IntoIter<T> {
|
||||
iter: Map<(T, ()), T, MoveEntries<T, ()>, fn((T, ())) -> T>
|
||||
iter: Map<(T, ()), T, ::btree_map::IntoIter<T, ()>, fn((T, ())) -> T>
|
||||
}
|
||||
|
||||
/// A lazy iterator producing elements in the set difference (in-order).
|
||||
pub struct DifferenceItems<'a, T:'a> {
|
||||
pub struct Difference<'a, T:'a> {
|
||||
a: Peekable<&'a T, Iter<'a, T>>,
|
||||
b: Peekable<&'a T, Iter<'a, T>>,
|
||||
}
|
||||
|
||||
/// A lazy iterator producing elements in the set symmetric difference (in-order).
|
||||
pub struct SymDifferenceItems<'a, T:'a> {
|
||||
pub struct SymmetricDifference<'a, T:'a> {
|
||||
a: Peekable<&'a T, Iter<'a, T>>,
|
||||
b: Peekable<&'a T, Iter<'a, T>>,
|
||||
}
|
||||
|
||||
/// A lazy iterator producing elements in the set intersection (in-order).
|
||||
pub struct IntersectionItems<'a, T:'a> {
|
||||
pub struct Intersection<'a, T:'a> {
|
||||
a: Peekable<&'a T, Iter<'a, T>>,
|
||||
b: Peekable<&'a T, Iter<'a, T>>,
|
||||
}
|
||||
|
||||
/// A lazy iterator producing elements in the set union (in-order).
|
||||
pub struct UnionItems<'a, T:'a> {
|
||||
pub struct Union<'a, T:'a> {
|
||||
a: Peekable<&'a T, Iter<'a, T>>,
|
||||
b: Peekable<&'a T, Iter<'a, T>>,
|
||||
}
|
||||
@ -151,8 +151,8 @@ impl<T: Ord> BTreeSet<T> {
|
||||
/// assert_eq!(diff, vec![1u]);
|
||||
/// ```
|
||||
#[unstable = "matches collection reform specification, waiting for dust to settle"]
|
||||
pub fn difference<'a>(&'a self, other: &'a BTreeSet<T>) -> DifferenceItems<'a, T> {
|
||||
DifferenceItems{a: self.iter().peekable(), b: other.iter().peekable()}
|
||||
pub fn difference<'a>(&'a self, other: &'a BTreeSet<T>) -> Difference<'a, T> {
|
||||
Difference{a: self.iter().peekable(), b: other.iter().peekable()}
|
||||
}
|
||||
|
||||
/// Visits the values representing the symmetric difference, in ascending order.
|
||||
@ -175,8 +175,8 @@ impl<T: Ord> BTreeSet<T> {
|
||||
/// ```
|
||||
#[unstable = "matches collection reform specification, waiting for dust to settle"]
|
||||
pub fn symmetric_difference<'a>(&'a self, other: &'a BTreeSet<T>)
|
||||
-> SymDifferenceItems<'a, T> {
|
||||
SymDifferenceItems{a: self.iter().peekable(), b: other.iter().peekable()}
|
||||
-> SymmetricDifference<'a, T> {
|
||||
SymmetricDifference{a: self.iter().peekable(), b: other.iter().peekable()}
|
||||
}
|
||||
|
||||
/// Visits the values representing the intersection, in ascending order.
|
||||
@ -199,8 +199,8 @@ impl<T: Ord> BTreeSet<T> {
|
||||
/// ```
|
||||
#[unstable = "matches collection reform specification, waiting for dust to settle"]
|
||||
pub fn intersection<'a>(&'a self, other: &'a BTreeSet<T>)
|
||||
-> IntersectionItems<'a, T> {
|
||||
IntersectionItems{a: self.iter().peekable(), b: other.iter().peekable()}
|
||||
-> Intersection<'a, T> {
|
||||
Intersection{a: self.iter().peekable(), b: other.iter().peekable()}
|
||||
}
|
||||
|
||||
/// Visits the values representing the union, in ascending order.
|
||||
@ -220,8 +220,8 @@ impl<T: Ord> BTreeSet<T> {
|
||||
/// assert_eq!(union, vec![1u,2]);
|
||||
/// ```
|
||||
#[unstable = "matches collection reform specification, waiting for dust to settle"]
|
||||
pub fn union<'a>(&'a self, other: &'a BTreeSet<T>) -> UnionItems<'a, T> {
|
||||
UnionItems{a: self.iter().peekable(), b: other.iter().peekable()}
|
||||
pub fn union<'a>(&'a self, other: &'a BTreeSet<T>) -> Union<'a, T> {
|
||||
Union{a: self.iter().peekable(), b: other.iter().peekable()}
|
||||
}
|
||||
|
||||
/// Return the number of elements in the set
|
||||
@ -573,7 +573,7 @@ fn cmp_opt<T: Ord>(x: Option<&T>, y: Option<&T>,
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: Ord> Iterator<&'a T> for DifferenceItems<'a, T> {
|
||||
impl<'a, T: Ord> Iterator<&'a T> for Difference<'a, T> {
|
||||
fn next(&mut self) -> Option<&'a T> {
|
||||
loop {
|
||||
match cmp_opt(self.a.peek(), self.b.peek(), Less, Less) {
|
||||
@ -585,7 +585,7 @@ impl<'a, T: Ord> Iterator<&'a T> for DifferenceItems<'a, T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: Ord> Iterator<&'a T> for SymDifferenceItems<'a, T> {
|
||||
impl<'a, T: Ord> Iterator<&'a T> for SymmetricDifference<'a, T> {
|
||||
fn next(&mut self) -> Option<&'a T> {
|
||||
loop {
|
||||
match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) {
|
||||
@ -597,7 +597,7 @@ impl<'a, T: Ord> Iterator<&'a T> for SymDifferenceItems<'a, T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: Ord> Iterator<&'a T> for IntersectionItems<'a, T> {
|
||||
impl<'a, T: Ord> Iterator<&'a T> for Intersection<'a, T> {
|
||||
fn next(&mut self) -> Option<&'a T> {
|
||||
loop {
|
||||
let o_cmp = match (self.a.peek(), self.b.peek()) {
|
||||
@ -615,7 +615,7 @@ impl<'a, T: Ord> Iterator<&'a T> for IntersectionItems<'a, T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: Ord> Iterator<&'a T> for UnionItems<'a, T> {
|
||||
impl<'a, T: Ord> Iterator<&'a T> for Union<'a, T> {
|
||||
fn next(&mut self) -> Option<&'a T> {
|
||||
loop {
|
||||
match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) {
|
||||
|
@ -176,8 +176,8 @@ impl<V> VecMap<V> {
|
||||
/// }
|
||||
/// ```
|
||||
#[unstable = "matches collection reform specification, waiting for dust to settle"]
|
||||
pub fn iter<'r>(&'r self) -> Entries<'r, V> {
|
||||
Entries {
|
||||
pub fn iter<'r>(&'r self) -> Iter<'r, V> {
|
||||
Iter {
|
||||
front: 0,
|
||||
back: self.v.len(),
|
||||
iter: self.v.iter()
|
||||
@ -207,8 +207,8 @@ impl<V> VecMap<V> {
|
||||
/// }
|
||||
/// ```
|
||||
#[unstable = "matches collection reform specification, waiting for dust to settle"]
|
||||
pub fn iter_mut<'r>(&'r mut self) -> MutEntries<'r, V> {
|
||||
MutEntries {
|
||||
pub fn iter_mut<'r>(&'r mut self) -> IterMut<'r, V> {
|
||||
IterMut {
|
||||
front: 0,
|
||||
back: self.v.len(),
|
||||
iter: self.v.iter_mut()
|
||||
@ -605,34 +605,34 @@ macro_rules! double_ended_iterator {
|
||||
}
|
||||
|
||||
/// An iterator over the key-value pairs of a map.
|
||||
pub struct Entries<'a, V:'a> {
|
||||
pub struct Iter<'a, V:'a> {
|
||||
front: uint,
|
||||
back: uint,
|
||||
iter: slice::Iter<'a, Option<V>>
|
||||
}
|
||||
|
||||
iterator! { impl Entries -> (uint, &'a V), as_ref }
|
||||
double_ended_iterator! { impl Entries -> (uint, &'a V), as_ref }
|
||||
iterator! { impl Iter -> (uint, &'a V), as_ref }
|
||||
double_ended_iterator! { impl Iter -> (uint, &'a V), as_ref }
|
||||
|
||||
/// An iterator over the key-value pairs of a map, with the
|
||||
/// values being mutable.
|
||||
pub struct MutEntries<'a, V:'a> {
|
||||
pub struct IterMut<'a, V:'a> {
|
||||
front: uint,
|
||||
back: uint,
|
||||
iter: slice::IterMut<'a, Option<V>>
|
||||
}
|
||||
|
||||
iterator! { impl MutEntries -> (uint, &'a mut V), as_mut }
|
||||
double_ended_iterator! { impl MutEntries -> (uint, &'a mut V), as_mut }
|
||||
iterator! { impl IterMut -> (uint, &'a mut V), as_mut }
|
||||
double_ended_iterator! { impl IterMut -> (uint, &'a mut V), as_mut }
|
||||
|
||||
/// An iterator over the keys of a map.
|
||||
pub struct Keys<'a, V: 'a> {
|
||||
iter: Map<(uint, &'a V), uint, Entries<'a, V>, fn((uint, &'a V)) -> uint>
|
||||
iter: Map<(uint, &'a V), uint, Iter<'a, V>, fn((uint, &'a V)) -> uint>
|
||||
}
|
||||
|
||||
/// An iterator over the values of a map.
|
||||
pub struct Values<'a, V: 'a> {
|
||||
iter: Map<(uint, &'a V), &'a V, Entries<'a, V>, fn((uint, &'a V)) -> &'a V>
|
||||
iter: Map<(uint, &'a V), &'a V, Iter<'a, V>, fn((uint, &'a V)) -> &'a V>
|
||||
}
|
||||
|
||||
/// A consuming iterator over the key-value pairs of a map.
|
||||
|
@ -781,7 +781,7 @@ iterator!{struct Iter -> *const T, &'a T}
|
||||
#[experimental = "needs review"]
|
||||
impl<'a, T> ExactSizeIterator<&'a T> for Iter<'a, T> {}
|
||||
|
||||
#[experimental = "needs review"]
|
||||
#[stable]
|
||||
impl<'a, T> Clone for Iter<'a, T> {
|
||||
fn clone(&self) -> Iter<'a, T> { *self }
|
||||
}
|
||||
|
@ -914,8 +914,8 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
|
||||
/// }
|
||||
/// ```
|
||||
#[unstable = "matches collection reform specification, waiting for dust to settle"]
|
||||
pub fn iter_mut(&mut self) -> MutEntries<K, V> {
|
||||
MutEntries { inner: self.table.iter_mut() }
|
||||
pub fn iter_mut(&mut self) -> IterMut<K, V> {
|
||||
IterMut { inner: self.table.iter_mut() }
|
||||
}
|
||||
|
||||
/// Creates a consuming iterator, that is, one that moves each key-value
|
||||
@ -936,10 +936,10 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
|
||||
/// let vec: Vec<(&str, int)> = map.into_iter().collect();
|
||||
/// ```
|
||||
#[unstable = "matches collection reform specification, waiting for dust to settle"]
|
||||
pub fn into_iter(self) -> MoveEntries<K, V> {
|
||||
pub fn into_iter(self) -> IntoIter<K, V> {
|
||||
fn last_two<A, B, C>((_, b, c): (A, B, C)) -> (B, C) { (b, c) }
|
||||
|
||||
MoveEntries {
|
||||
IntoIter {
|
||||
inner: self.table.into_iter().map(last_two)
|
||||
}
|
||||
}
|
||||
@ -1306,16 +1306,16 @@ pub struct Entries<'a, K: 'a, V: 'a> {
|
||||
}
|
||||
|
||||
/// HashMap mutable values iterator
|
||||
pub struct MutEntries<'a, K: 'a, V: 'a> {
|
||||
inner: table::MutEntries<'a, K, V>
|
||||
pub struct IterMut<'a, K: 'a, V: 'a> {
|
||||
inner: table::IterMut<'a, K, V>
|
||||
}
|
||||
|
||||
/// HashMap move iterator
|
||||
pub struct MoveEntries<K, V> {
|
||||
pub struct IntoIter<K, V> {
|
||||
inner: iter::Map<
|
||||
(SafeHash, K, V),
|
||||
(K, V),
|
||||
table::MoveEntries<K, V>,
|
||||
table::IntoIter<K, V>,
|
||||
fn((SafeHash, K, V)) -> (K, V),
|
||||
>
|
||||
}
|
||||
@ -1374,12 +1374,12 @@ impl<'a, K, V> Iterator<(&'a K, &'a V)> for Entries<'a, K, V> {
|
||||
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
|
||||
}
|
||||
|
||||
impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> {
|
||||
impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> {
|
||||
#[inline] fn next(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next() }
|
||||
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
|
||||
}
|
||||
|
||||
impl<K, V> Iterator<(K, V)> for MoveEntries<K, V> {
|
||||
impl<K, V> Iterator<(K, V)> for IntoIter<K, V> {
|
||||
#[inline] fn next(&mut self) -> Option<(K, V)> { self.inner.next() }
|
||||
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ use iter::{Iterator, IteratorExt, FromIterator, Map, Chain, Extend};
|
||||
use option::Option::{Some, None, mod};
|
||||
use result::Result::{Ok, Err};
|
||||
|
||||
use super::map::{mod, HashMap, MoveEntries, Keys, INITIAL_CAPACITY};
|
||||
use super::map::{mod, HashMap, Keys, INITIAL_CAPACITY};
|
||||
|
||||
// FIXME(conventions): implement BitOr, BitAnd, BitXor, and Sub
|
||||
|
||||
@ -625,7 +625,7 @@ pub struct Iter<'a, K: 'a> {
|
||||
|
||||
/// HashSet move iterator
|
||||
pub struct IntoIter<K> {
|
||||
iter: Map<(K, ()), K, MoveEntries<K, ()>, fn((K, ())) -> K>
|
||||
iter: Map<(K, ()), K, map::IntoIter<K, ()>, fn((K, ())) -> K>
|
||||
}
|
||||
|
||||
/// HashSet drain iterator
|
||||
|
@ -664,17 +664,17 @@ impl<K, V> RawTable<K, V> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn iter_mut(&mut self) -> MutEntries<K, V> {
|
||||
MutEntries {
|
||||
pub fn iter_mut(&mut self) -> IterMut<K, V> {
|
||||
IterMut {
|
||||
iter: self.raw_buckets(),
|
||||
elems_left: self.size(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn into_iter(self) -> MoveEntries<K, V> {
|
||||
pub fn into_iter(self) -> IntoIter<K, V> {
|
||||
let RawBuckets { raw, hashes_end, .. } = self.raw_buckets();
|
||||
// Replace the marker regardless of lifetime bounds on parameters.
|
||||
MoveEntries {
|
||||
IntoIter {
|
||||
iter: RawBuckets {
|
||||
raw: raw,
|
||||
hashes_end: hashes_end,
|
||||
@ -776,13 +776,13 @@ pub struct Entries<'a, K: 'a, V: 'a> {
|
||||
}
|
||||
|
||||
/// Iterator over mutable references to entries in a table.
|
||||
pub struct MutEntries<'a, K: 'a, V: 'a> {
|
||||
pub struct IterMut<'a, K: 'a, V: 'a> {
|
||||
iter: RawBuckets<'a, K, V>,
|
||||
elems_left: uint,
|
||||
}
|
||||
|
||||
/// Iterator over the entries in a table, consuming the table.
|
||||
pub struct MoveEntries<K, V> {
|
||||
pub struct IntoIter<K, V> {
|
||||
table: RawTable<K, V>,
|
||||
iter: RawBuckets<'static, K, V>
|
||||
}
|
||||
@ -809,7 +809,7 @@ impl<'a, K, V> Iterator<(&'a K, &'a V)> for Entries<'a, K, V> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> {
|
||||
impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> {
|
||||
fn next(&mut self) -> Option<(&'a K, &'a mut V)> {
|
||||
self.iter.next().map(|bucket| {
|
||||
self.elems_left -= 1;
|
||||
@ -825,7 +825,7 @@ impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<K, V> Iterator<(SafeHash, K, V)> for MoveEntries<K, V> {
|
||||
impl<K, V> Iterator<(SafeHash, K, V)> for IntoIter<K, V> {
|
||||
fn next(&mut self) -> Option<(SafeHash, K, V)> {
|
||||
self.iter.next().map(|bucket| {
|
||||
self.table.size -= 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user