Update std::collections' docs to use iterator (etc.) boilerplate
This greatly improves consistency.
This commit is contained in:
parent
ea376822a1
commit
d64de94efa
7 changed files with 252 additions and 50 deletions
|
|
@ -218,10 +218,14 @@ pub struct BinaryHeap<T> {
|
|||
data: Vec<T>,
|
||||
}
|
||||
|
||||
/// A container object that represents the result of the [`peek_mut`] method
|
||||
/// on `BinaryHeap`. See its documentation for details.
|
||||
/// Object representing a mutable reference to the greatest item on a
|
||||
/// `BinaryHeap`.
|
||||
///
|
||||
/// This `struct` is created by the [`peek_mut`] method on [`BinaryHeap`]. See
|
||||
/// its documentation for more.
|
||||
///
|
||||
/// [`peek_mut`]: struct.BinaryHeap.html#method.peek_mut
|
||||
/// [`BinaryHeap`]: struct.BinaryHeap.html
|
||||
#[stable(feature = "binary_heap_peek_mut", since = "1.12.0")]
|
||||
pub struct PeekMut<'a, T: 'a + Ord> {
|
||||
heap: &'a mut BinaryHeap<T>,
|
||||
|
|
@ -971,7 +975,13 @@ impl<'a, T> Drop for Hole<'a, T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// `BinaryHeap` iterator.
|
||||
/// An iterator over the elements of a `BinaryHeap`.
|
||||
///
|
||||
/// This `struct` is created by the [`iter`] method on [`BinaryHeap`]. See its
|
||||
/// documentation for more.
|
||||
///
|
||||
/// [`iter`]: struct.BinaryHeap.html#method.iter
|
||||
/// [`BinaryHeap`]: struct.BinaryHeap.html
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Iter<'a, T: 'a> {
|
||||
iter: slice::Iter<'a, T>,
|
||||
|
|
@ -1027,7 +1037,13 @@ impl<'a, T> ExactSizeIterator for Iter<'a, T> {
|
|||
#[unstable(feature = "fused", issue = "35602")]
|
||||
impl<'a, T> FusedIterator for Iter<'a, T> {}
|
||||
|
||||
/// An iterator that moves out of a `BinaryHeap`.
|
||||
/// An owning iterator over the elements of a `BinaryHeap`.
|
||||
///
|
||||
/// This `struct` is created by the [`into_iter`] method on [`BinaryHeap`]
|
||||
/// (provided by the `IntoIterator` trait). See its documentation for more.
|
||||
///
|
||||
/// [`into_iter`]: struct.BinaryHeap.html#method.into_iter
|
||||
/// [`BinaryHeap`]: struct.BinaryHeap.html
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[derive(Clone)]
|
||||
pub struct IntoIter<T> {
|
||||
|
|
@ -1076,7 +1092,13 @@ impl<T> ExactSizeIterator for IntoIter<T> {
|
|||
#[unstable(feature = "fused", issue = "35602")]
|
||||
impl<T> FusedIterator for IntoIter<T> {}
|
||||
|
||||
/// An iterator that drains a `BinaryHeap`.
|
||||
/// A draining iterator over the elements of a `BinaryHeap`.
|
||||
///
|
||||
/// This `struct` is created by the [`drain`] method on [`BinaryHeap`]. See its
|
||||
/// documentation for more.
|
||||
///
|
||||
/// [`drain`]: struct.BinaryHeap.html#method.drain
|
||||
/// [`BinaryHeap`]: struct.BinaryHeap.html
|
||||
#[stable(feature = "drain", since = "1.6.0")]
|
||||
#[derive(Debug)]
|
||||
pub struct Drain<'a, T: 'a> {
|
||||
|
|
|
|||
|
|
@ -262,7 +262,13 @@ impl<K, Q: ?Sized> super::Recover<Q> for BTreeMap<K, ()>
|
|||
}
|
||||
}
|
||||
|
||||
/// An iterator over a `BTreeMap`'s entries.
|
||||
/// An iterator over the entries of a `BTreeMap`.
|
||||
///
|
||||
/// This `struct` is created by the [`iter`] method on [`BTreeMap`]. See its
|
||||
/// documentation for more.
|
||||
///
|
||||
/// [`iter`]: struct.BTreeMap.html#method.iter
|
||||
/// [`BTreeMap`]: struct.BTreeMap.html
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Iter<'a, K: 'a, V: 'a> {
|
||||
range: Range<'a, K, V>,
|
||||
|
|
@ -276,7 +282,13 @@ impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Iter<'a, K, V> {
|
|||
}
|
||||
}
|
||||
|
||||
/// A mutable iterator over a `BTreeMap`'s entries.
|
||||
/// A mutable iterator over the entries of a `BTreeMap`.
|
||||
///
|
||||
/// This `struct` is created by the [`iter_mut`] method on [`BTreeMap`]. See its
|
||||
/// documentation for more.
|
||||
///
|
||||
/// [`iter_mut`]: struct.BTreeMap.html#method.iter_mut
|
||||
/// [`BTreeMap`]: struct.BTreeMap.html
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[derive(Debug)]
|
||||
pub struct IterMut<'a, K: 'a, V: 'a> {
|
||||
|
|
@ -284,7 +296,13 @@ pub struct IterMut<'a, K: 'a, V: 'a> {
|
|||
length: usize,
|
||||
}
|
||||
|
||||
/// An owning iterator over a `BTreeMap`'s entries.
|
||||
/// An owning iterator over the entries of a `BTreeMap`.
|
||||
///
|
||||
/// This `struct` is created by the [`into_iter`] method on [`BTreeMap`]
|
||||
/// (provided by the `IntoIterator` trait). See its documentation for more.
|
||||
///
|
||||
/// [`into_iter`]: struct.BTreeMap.html#method.into_iter
|
||||
/// [`BTreeMap`]: struct.BTreeMap.html
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct IntoIter<K, V> {
|
||||
front: Handle<NodeRef<marker::Owned, K, V, marker::Leaf>, marker::Edge>,
|
||||
|
|
@ -303,7 +321,13 @@ impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for IntoIter<K, V> {
|
|||
}
|
||||
}
|
||||
|
||||
/// An iterator over a `BTreeMap`'s keys.
|
||||
/// An iterator over the keys of a `BTreeMap`.
|
||||
///
|
||||
/// This `struct` is created by the [`keys`] method on [`BTreeMap`]. See its
|
||||
/// documentation for more.
|
||||
///
|
||||
/// [`keys`]: struct.BTreeMap.html#method.keys
|
||||
/// [`BTreeMap`]: struct.BTreeMap.html
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Keys<'a, K: 'a, V: 'a> {
|
||||
inner: Iter<'a, K, V>,
|
||||
|
|
@ -316,7 +340,13 @@ impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Keys<'a, K, V> {
|
|||
}
|
||||
}
|
||||
|
||||
/// An iterator over a `BTreeMap`'s values.
|
||||
/// An iterator over the values of a `BTreeMap`.
|
||||
///
|
||||
/// This `struct` is created by the [`values`] method on [`BTreeMap`]. See its
|
||||
/// documentation for more.
|
||||
///
|
||||
/// [`values`]: struct.BTreeMap.html#method.values
|
||||
/// [`BTreeMap`]: struct.BTreeMap.html
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Values<'a, K: 'a, V: 'a> {
|
||||
inner: Iter<'a, K, V>,
|
||||
|
|
@ -329,14 +359,26 @@ impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Values<'a, K, V>
|
|||
}
|
||||
}
|
||||
|
||||
/// A mutable iterator over a `BTreeMap`'s values.
|
||||
/// A mutable iterator over the values of a `BTreeMap`.
|
||||
///
|
||||
/// This `struct` is created by the [`values_mut`] method on [`BTreeMap`]. See its
|
||||
/// documentation for more.
|
||||
///
|
||||
/// [`values_mut`]: struct.BTreeMap.html#method.values_mut
|
||||
/// [`BTreeMap`]: struct.BTreeMap.html
|
||||
#[stable(feature = "map_values_mut", since = "1.10.0")]
|
||||
#[derive(Debug)]
|
||||
pub struct ValuesMut<'a, K: 'a, V: 'a> {
|
||||
inner: IterMut<'a, K, V>,
|
||||
}
|
||||
|
||||
/// An iterator over a sub-range of `BTreeMap`'s entries.
|
||||
/// An iterator over a sub-range of entries in a `BTreeMap`.
|
||||
///
|
||||
/// This `struct` is created by the [`range`] method on [`BTreeMap`]. See its
|
||||
/// documentation for more.
|
||||
///
|
||||
/// [`range`]: struct.BTreeMap.html#method.range
|
||||
/// [`BTreeMap`]: struct.BTreeMap.html
|
||||
#[stable(feature = "btree_range", since = "1.17.0")]
|
||||
pub struct Range<'a, K: 'a, V: 'a> {
|
||||
front: Handle<NodeRef<marker::Immut<'a>, K, V, marker::Leaf>, marker::Edge>,
|
||||
|
|
@ -350,7 +392,13 @@ impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Range<'a, K, V>
|
|||
}
|
||||
}
|
||||
|
||||
/// A mutable iterator over a sub-range of `BTreeMap`'s entries.
|
||||
/// A mutable iterator over a sub-range of entries in a `BTreeMap`.
|
||||
///
|
||||
/// This `struct` is created by the [`range_mut`] method on [`BTreeMap`]. See its
|
||||
/// documentation for more.
|
||||
///
|
||||
/// [`range_mut`]: struct.BTreeMap.html#method.range_mut
|
||||
/// [`BTreeMap`]: struct.BTreeMap.html
|
||||
#[stable(feature = "btree_range", since = "1.17.0")]
|
||||
pub struct RangeMut<'a, K: 'a, V: 'a> {
|
||||
front: Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>,
|
||||
|
|
|
|||
|
|
@ -74,9 +74,10 @@ pub struct BTreeSet<T> {
|
|||
map: BTreeMap<T, ()>,
|
||||
}
|
||||
|
||||
/// An iterator over a `BTreeSet`'s items.
|
||||
/// An iterator over the items of a `BTreeSet`.
|
||||
///
|
||||
/// This structure is created by the [`iter`] method on [`BTreeSet`].
|
||||
/// This `struct` is created by the [`iter`] method on [`BTreeSet`].
|
||||
/// See its documentation for more.
|
||||
///
|
||||
/// [`BTreeSet`]: struct.BTreeSet.html
|
||||
/// [`iter`]: struct.BTreeSet.html#method.iter
|
||||
|
|
@ -94,21 +95,23 @@ impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// An owning iterator over a `BTreeSet`'s items.
|
||||
/// An owning iterator over the items of a `BTreeSet`.
|
||||
///
|
||||
/// This structure is created by the `into_iter` method on [`BTreeSet`]
|
||||
/// [`BTreeSet`] (provided by the `IntoIterator` trait).
|
||||
/// This `struct` is created by the [`into_iter`] method on [`BTreeSet`]
|
||||
/// (provided by the `IntoIterator` trait). See its documentation for more.
|
||||
///
|
||||
/// [`BTreeSet`]: struct.BTreeSet.html
|
||||
/// [`into_iter`]: struct.BTreeSet.html#method.into_iter
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[derive(Debug)]
|
||||
pub struct IntoIter<T> {
|
||||
iter: ::btree_map::IntoIter<T, ()>,
|
||||
}
|
||||
|
||||
/// An iterator over a sub-range of `BTreeSet`'s items.
|
||||
/// An iterator over a sub-range of items in a `BTreeSet`.
|
||||
///
|
||||
/// This structure is created by the [`range`] method on [`BTreeSet`].
|
||||
/// This `struct` is created by the [`range`] method on [`BTreeSet`].
|
||||
/// See its documentation for more.
|
||||
///
|
||||
/// [`BTreeSet`]: struct.BTreeSet.html
|
||||
/// [`range`]: struct.BTreeSet.html#method.range
|
||||
|
|
@ -118,9 +121,10 @@ pub struct Range<'a, T: 'a> {
|
|||
iter: ::btree_map::Range<'a, T, ()>,
|
||||
}
|
||||
|
||||
/// A lazy iterator producing elements in the set difference (in-order).
|
||||
/// A lazy iterator producing elements in the difference of `BTreeSet`s.
|
||||
///
|
||||
/// This structure is created by the [`difference`] method on [`BTreeSet`].
|
||||
/// This `struct` is created by the [`difference`] method on [`BTreeSet`].
|
||||
/// See its documentation for more.
|
||||
///
|
||||
/// [`BTreeSet`]: struct.BTreeSet.html
|
||||
/// [`difference`]: struct.BTreeSet.html#method.difference
|
||||
|
|
@ -139,10 +143,10 @@ impl<'a, T: 'a + fmt::Debug> fmt::Debug for Difference<'a, T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// A lazy iterator producing elements in the set symmetric difference (in-order).
|
||||
/// A lazy iterator producing elements in the symmetric difference of `BTreeSet`s.
|
||||
///
|
||||
/// This structure is created by the [`symmetric_difference`] method on
|
||||
/// [`BTreeSet`].
|
||||
/// This `struct` is created by the [`symmetric_difference`] method on
|
||||
/// [`BTreeSet`]. See its documentation for more.
|
||||
///
|
||||
/// [`BTreeSet`]: struct.BTreeSet.html
|
||||
/// [`symmetric_difference`]: struct.BTreeSet.html#method.symmetric_difference
|
||||
|
|
@ -161,9 +165,10 @@ impl<'a, T: 'a + fmt::Debug> fmt::Debug for SymmetricDifference<'a, T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// A lazy iterator producing elements in the set intersection (in-order).
|
||||
/// A lazy iterator producing elements in the intersection of `BTreeSet`s.
|
||||
///
|
||||
/// This structure is created by the [`intersection`] method on [`BTreeSet`].
|
||||
/// This `struct` is created by the [`intersection`] method on [`BTreeSet`].
|
||||
/// See its documentation for more.
|
||||
///
|
||||
/// [`BTreeSet`]: struct.BTreeSet.html
|
||||
/// [`intersection`]: struct.BTreeSet.html#method.intersection
|
||||
|
|
@ -182,9 +187,10 @@ impl<'a, T: 'a + fmt::Debug> fmt::Debug for Intersection<'a, T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// A lazy iterator producing elements in the set union (in-order).
|
||||
/// A lazy iterator producing elements in the union of `BTreeSet`s.
|
||||
///
|
||||
/// This structure is created by the [`union`] method on [`BTreeSet`].
|
||||
/// This `struct` is created by the [`union`] method on [`BTreeSet`].
|
||||
/// See its documentation for more.
|
||||
///
|
||||
/// [`BTreeSet`]: struct.BTreeSet.html
|
||||
/// [`union`]: struct.BTreeSet.html#method.union
|
||||
|
|
|
|||
|
|
@ -56,7 +56,13 @@ struct Node<T> {
|
|||
element: T,
|
||||
}
|
||||
|
||||
/// An iterator over references to the elements of a `LinkedList`.
|
||||
/// An iterator over the elements of a `LinkedList`.
|
||||
///
|
||||
/// This `struct` is created by the [`iter`] method on [`LinkedList`]. See its
|
||||
/// documentation for more.
|
||||
///
|
||||
/// [`iter`]: struct.LinkedList.html#method.iter
|
||||
/// [`LinkedList`]: struct.LinkedList.html
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Iter<'a, T: 'a> {
|
||||
head: Option<Shared<Node<T>>>,
|
||||
|
|
@ -82,7 +88,13 @@ impl<'a, T> Clone for Iter<'a, T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// An iterator over mutable references to the elements of a `LinkedList`.
|
||||
/// A mutable iterator over the elements of a `LinkedList`.
|
||||
///
|
||||
/// This `struct` is created by the [`iter_mut`] method on [`LinkedList`]. See its
|
||||
/// documentation for more.
|
||||
///
|
||||
/// [`iter_mut`]: struct.LinkedList.html#method.iter_mut
|
||||
/// [`LinkedList`]: struct.LinkedList.html
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct IterMut<'a, T: 'a> {
|
||||
list: &'a mut LinkedList<T>,
|
||||
|
|
@ -100,7 +112,13 @@ impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// An iterator over the elements of a `LinkedList`.
|
||||
/// An owning iterator over the elements of a `LinkedList`.
|
||||
///
|
||||
/// This `struct` is created by the [`into_iter`] method on [`LinkedList`]
|
||||
/// (provided by the `IntoIterator` trait). See its documentation for more.
|
||||
///
|
||||
/// [`into_iter`]: struct.LinkedList.html#method.into_iter
|
||||
/// [`LinkedList`]: struct.LinkedList.html
|
||||
#[derive(Clone)]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct IntoIter<T> {
|
||||
|
|
|
|||
|
|
@ -1890,7 +1890,13 @@ fn count(tail: usize, head: usize, size: usize) -> usize {
|
|||
(head.wrapping_sub(tail)) & (size - 1)
|
||||
}
|
||||
|
||||
/// `VecDeque` iterator.
|
||||
/// An iterator over the elements of a `VecDeque`.
|
||||
///
|
||||
/// This `struct` is created by the [`iter`] method on [`VecDeque`]. See its
|
||||
/// documentation for more.
|
||||
///
|
||||
/// [`iter`]: struct.VecDeque.html#method.iter
|
||||
/// [`VecDeque`]: struct.VecDeque.html
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Iter<'a, T: 'a> {
|
||||
ring: &'a [T],
|
||||
|
|
@ -1971,7 +1977,13 @@ impl<'a, T> ExactSizeIterator for Iter<'a, T> {
|
|||
impl<'a, T> FusedIterator for Iter<'a, T> {}
|
||||
|
||||
|
||||
/// `VecDeque` mutable iterator.
|
||||
/// A mutable iterator over the elements of a `VecDeque`.
|
||||
///
|
||||
/// This `struct` is created by the [`iter_mut`] method on [`VecDeque`]. See its
|
||||
/// documentation for more.
|
||||
///
|
||||
/// [`iter_mut`]: struct.VecDeque.html#method.iter_mut
|
||||
/// [`VecDeque`]: struct.VecDeque.html
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct IterMut<'a, T: 'a> {
|
||||
ring: &'a mut [T],
|
||||
|
|
@ -2047,7 +2059,13 @@ impl<'a, T> ExactSizeIterator for IterMut<'a, T> {
|
|||
#[unstable(feature = "fused", issue = "35602")]
|
||||
impl<'a, T> FusedIterator for IterMut<'a, T> {}
|
||||
|
||||
/// A by-value `VecDeque` iterator
|
||||
/// An owning iterator over the elements of a `VecDeque`.
|
||||
///
|
||||
/// This `struct` is created by the [`into_iter`] method on [`VecDeque`]
|
||||
/// (provided by the `IntoIterator` trait). See its documentation for more.
|
||||
///
|
||||
/// [`into_iter`]: struct.VecDeque.html#method.into_iter
|
||||
/// [`VecDeque`]: struct.VecDeque.html
|
||||
#[derive(Clone)]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct IntoIter<T> {
|
||||
|
|
@ -2097,7 +2115,13 @@ impl<T> ExactSizeIterator for IntoIter<T> {
|
|||
#[unstable(feature = "fused", issue = "35602")]
|
||||
impl<T> FusedIterator for IntoIter<T> {}
|
||||
|
||||
/// A draining `VecDeque` iterator
|
||||
/// A draining iterator over the elements of a `VecDeque`.
|
||||
///
|
||||
/// This `struct` is created by the [`drain`] method on [`VecDeque`]. See its
|
||||
/// documentation for more.
|
||||
///
|
||||
/// [`drain`]: struct.VecDeque.html#method.drain
|
||||
/// [`VecDeque`]: struct.VecDeque.html
|
||||
#[stable(feature = "drain", since = "1.6.0")]
|
||||
pub struct Drain<'a, T: 'a> {
|
||||
after_tail: usize,
|
||||
|
|
|
|||
|
|
@ -1333,7 +1333,13 @@ impl<'a, K, Q: ?Sized, V, S> Index<&'a Q> for HashMap<K, V, S>
|
|||
}
|
||||
}
|
||||
|
||||
/// HashMap iterator.
|
||||
/// An iterator over the entries of a `HashMap`.
|
||||
///
|
||||
/// This `struct` is created by the [`iter`] method on [`HashMap`]. See its
|
||||
/// documentation for more.
|
||||
///
|
||||
/// [`iter`]: struct.HashMap.html#method.iter
|
||||
/// [`HashMap`]: struct.HashMap.html
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Iter<'a, K: 'a, V: 'a> {
|
||||
inner: table::Iter<'a, K, V>,
|
||||
|
|
@ -1356,19 +1362,37 @@ impl<'a, K: Debug, V: Debug> fmt::Debug for Iter<'a, K, V> {
|
|||
}
|
||||
}
|
||||
|
||||
/// HashMap mutable values iterator.
|
||||
/// A mutable iterator over the entries of a `HashMap`.
|
||||
///
|
||||
/// This `struct` is created by the [`iter_mut`] method on [`HashMap`]. See its
|
||||
/// documentation for more.
|
||||
///
|
||||
/// [`iter_mut`]: struct.HashMap.html#method.iter_mut
|
||||
/// [`HashMap`]: struct.HashMap.html
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct IterMut<'a, K: 'a, V: 'a> {
|
||||
inner: table::IterMut<'a, K, V>,
|
||||
}
|
||||
|
||||
/// HashMap move iterator.
|
||||
/// An owning iterator over the entries of a `HashMap`.
|
||||
///
|
||||
/// This `struct` is created by the [`into_iter`] method on [`HashMap`]
|
||||
/// (provided by the `IntoIterator` trait). See its documentation for more.
|
||||
///
|
||||
/// [`into_iter`]: struct.HashMap.html#method.into_iter
|
||||
/// [`HashMap`]: struct.HashMap.html
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct IntoIter<K, V> {
|
||||
pub(super) inner: table::IntoIter<K, V>,
|
||||
}
|
||||
|
||||
/// HashMap keys iterator.
|
||||
/// An iterator over the keys of a `HashMap`.
|
||||
///
|
||||
/// This `struct` is created by the [`keys`] method on [`HashMap`]. See its
|
||||
/// documentation for more.
|
||||
///
|
||||
/// [`keys`]: struct.HashMap.html#method.keys
|
||||
/// [`HashMap`]: struct.HashMap.html
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Keys<'a, K: 'a, V: 'a> {
|
||||
inner: Iter<'a, K, V>,
|
||||
|
|
@ -1391,7 +1415,13 @@ impl<'a, K: Debug, V: Debug> fmt::Debug for Keys<'a, K, V> {
|
|||
}
|
||||
}
|
||||
|
||||
/// HashMap values iterator.
|
||||
/// An iterator over the values of a `HashMap`.
|
||||
///
|
||||
/// This `struct` is created by the [`values`] method on [`HashMap`]. See its
|
||||
/// documentation for more.
|
||||
///
|
||||
/// [`values`]: struct.HashMap.html#method.values
|
||||
/// [`HashMap`]: struct.HashMap.html
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Values<'a, K: 'a, V: 'a> {
|
||||
inner: Iter<'a, K, V>,
|
||||
|
|
@ -1414,13 +1444,25 @@ impl<'a, K: Debug, V: Debug> fmt::Debug for Values<'a, K, V> {
|
|||
}
|
||||
}
|
||||
|
||||
/// HashMap drain iterator.
|
||||
/// A draining iterator over the entries of a `HashMap`.
|
||||
///
|
||||
/// This `struct` is created by the [`drain`] method on [`HashMap`]. See its
|
||||
/// documentation for more.
|
||||
///
|
||||
/// [`drain`]: struct.HashMap.html#method.drain
|
||||
/// [`HashMap`]: struct.HashMap.html
|
||||
#[stable(feature = "drain", since = "1.6.0")]
|
||||
pub struct Drain<'a, K: 'a, V: 'a> {
|
||||
pub(super) inner: table::Drain<'a, K, V>,
|
||||
}
|
||||
|
||||
/// Mutable HashMap values iterator.
|
||||
/// A mutable iterator over the values of a `HashMap`.
|
||||
///
|
||||
/// This `struct` is created by the [`values_mut`] method on [`HashMap`]. See its
|
||||
/// documentation for more.
|
||||
///
|
||||
/// [`values_mut`]: struct.HashMap.html#method.values_mut
|
||||
/// [`HashMap`]: struct.HashMap.html
|
||||
#[stable(feature = "map_values_mut", since = "1.10.0")]
|
||||
pub struct ValuesMut<'a, K: 'a, V: 'a> {
|
||||
inner: IterMut<'a, K, V>,
|
||||
|
|
|
|||
|
|
@ -856,25 +856,49 @@ impl<'a, 'b, T, S> Sub<&'b HashSet<T, S>> for &'a HashSet<T, S>
|
|||
}
|
||||
}
|
||||
|
||||
/// HashSet iterator
|
||||
/// An iterator over the items of a `HashSet`.
|
||||
///
|
||||
/// This `struct` is created by the [`iter`] method on [`HashSet`].
|
||||
/// See its documentation for more.
|
||||
///
|
||||
/// [`HashSet`]: struct.HashSet.html
|
||||
/// [`iter`]: struct.HashSet.html#method.iter
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Iter<'a, K: 'a> {
|
||||
iter: Keys<'a, K, ()>,
|
||||
}
|
||||
|
||||
/// HashSet move iterator
|
||||
/// An owning iterator over the items of a `HashSet`.
|
||||
///
|
||||
/// This `struct` is created by the [`into_iter`] method on [`HashSet`]
|
||||
/// (provided by the `IntoIterator` trait). See its documentation for more.
|
||||
///
|
||||
/// [`HashSet`]: struct.HashSet.html
|
||||
/// [`into_iter`]: struct.HashSet.html#method.into_iter
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct IntoIter<K> {
|
||||
iter: map::IntoIter<K, ()>,
|
||||
}
|
||||
|
||||
/// HashSet drain iterator
|
||||
/// A draining iterator over the items of a `HashSet`.
|
||||
///
|
||||
/// This `struct` is created by the [`drain`] method on [`HashSet`].
|
||||
/// See its documentation for more.
|
||||
///
|
||||
/// [`HashSet`]: struct.HashSet.html
|
||||
/// [`drain`]: struct.HashSet.html#method.drain
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Drain<'a, K: 'a> {
|
||||
iter: map::Drain<'a, K, ()>,
|
||||
}
|
||||
|
||||
/// Intersection iterator
|
||||
/// A lazy iterator producing elements in the intersection of `HashSet`s.
|
||||
///
|
||||
/// This `struct` is created by the [`intersection`] method on [`HashSet`].
|
||||
/// See its documentation for more.
|
||||
///
|
||||
/// [`HashSet`]: struct.HashSet.html
|
||||
/// [`intersection`]: struct.HashSet.html#method.intersection
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Intersection<'a, T: 'a, S: 'a> {
|
||||
// iterator of the first set
|
||||
|
|
@ -883,7 +907,13 @@ pub struct Intersection<'a, T: 'a, S: 'a> {
|
|||
other: &'a HashSet<T, S>,
|
||||
}
|
||||
|
||||
/// Difference iterator
|
||||
/// A lazy iterator producing elements in the difference of `HashSet`s.
|
||||
///
|
||||
/// This `struct` is created by the [`difference`] method on [`HashSet`].
|
||||
/// See its documentation for more.
|
||||
///
|
||||
/// [`HashSet`]: struct.HashSet.html
|
||||
/// [`difference`]: struct.HashSet.html#method.difference
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Difference<'a, T: 'a, S: 'a> {
|
||||
// iterator of the first set
|
||||
|
|
@ -892,13 +922,25 @@ pub struct Difference<'a, T: 'a, S: 'a> {
|
|||
other: &'a HashSet<T, S>,
|
||||
}
|
||||
|
||||
/// Symmetric difference iterator.
|
||||
/// A lazy iterator producing elements in the symmetric difference of `HashSet`s.
|
||||
///
|
||||
/// This `struct` is created by the [`symmetric_difference`] method on
|
||||
/// [`HashSet`]. See its documentation for more.
|
||||
///
|
||||
/// [`HashSet`]: struct.HashSet.html
|
||||
/// [`symmetric_difference`]: struct.HashSet.html#method.symmetric_difference
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct SymmetricDifference<'a, T: 'a, S: 'a> {
|
||||
iter: Chain<Difference<'a, T, S>, Difference<'a, T, S>>,
|
||||
}
|
||||
|
||||
/// Set union iterator.
|
||||
/// A lazy iterator producing elements in the union of `HashSet`s.
|
||||
///
|
||||
/// This `struct` is created by the [`union`] method on [`HashSet`].
|
||||
/// See its documentation for more.
|
||||
///
|
||||
/// [`HashSet`]: struct.HashSet.html
|
||||
/// [`union`]: struct.HashSet.html#method.union
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Union<'a, T: 'a, S: 'a> {
|
||||
iter: Chain<Iter<'a, T>, Difference<'a, T, S>>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue