Skip to content

Commit 07165f8

Browse files
Merge pull request #72 from jakoschiko/expose-iter-types
Expose iterator types
2 parents 40f9232 + b3ff185 commit 07165f8

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/iter.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ use crate::IntMap;
1010

1111
// ***************** Iter *********************
1212

13+
/// An iterator over the entries of a [`IntMap`]
14+
///
15+
/// This struct is created by [`IntMap::iter`].
1316
pub struct Iter<'a, K: IntKey, V> {
1417
inner: IterFlatten<SliceIter<'a, Vec<(K, V)>>>,
1518
}
@@ -33,6 +36,9 @@ impl<'a, K: IntKey, V> Iterator for Iter<'a, K, V> {
3336

3437
// ***************** Iter Mut *********************
3538

39+
/// A mutable iterator over the entries of a [`IntMap`].
40+
///
41+
/// This struct is created by [`IntMap::iter_mut`].
3642
pub struct IterMut<'a, K: IntKey, V> {
3743
inner: IterFlatten<SliceIterMut<'a, Vec<(K, V)>>>,
3844
}
@@ -56,6 +62,9 @@ impl<'a, K: IntKey, V> Iterator for IterMut<'a, K, V> {
5662

5763
// ***************** Keys Iter *********************
5864

65+
/// An iterator over the keys of a [`IntMap`].
66+
///
67+
/// This struct is created by [`IntMap::keys`].
5968
pub struct Keys<'a, K: IntKey, V> {
6069
pub(crate) inner: Iter<'a, K, V>,
6170
}
@@ -75,6 +84,9 @@ impl<'a, K: IntKey, V> Iterator for Keys<'a, K, V> {
7584

7685
// ***************** Values Iter *********************
7786

87+
/// An iterator over the values of a [`IntMap`].
88+
///
89+
/// This struct is created by [`IntMap::values`].
7890
pub struct Values<'a, K: IntKey, V> {
7991
pub(crate) inner: Iter<'a, K, V>,
8092
}
@@ -94,6 +106,9 @@ impl<'a, K: IntKey, V> Iterator for Values<'a, K, V> {
94106

95107
// ***************** Values Mut *********************
96108

109+
/// A mutable iterator over the values of a [`IntMap`].
110+
///
111+
/// This struct is created by [`IntMap::values_mut`].
97112
pub struct ValuesMut<'a, K: IntKey, V> {
98113
pub(crate) inner: IterMut<'a, K, V>,
99114
}
@@ -123,6 +138,9 @@ impl<K: IntKey, V> IntoIterator for IntMap<K, V> {
123138
}
124139
}
125140

141+
/// An owning iterator over the entries of a [`IntMap`].
142+
///
143+
/// This struct is created by [`IntMap::into_iter`].
126144
pub struct IntoIter<K: IntKey, V> {
127145
inner: IterFlatten<VecIntoIter<Vec<(K, V)>>>,
128146
}
@@ -146,6 +164,9 @@ impl<K: IntKey, V> Iterator for IntoIter<K, V> {
146164

147165
// ***************** Drain Iter *********************
148166

167+
/// A draining iterator for [`IntMap`].
168+
///
169+
/// This struct is created by [`IntMap::drain`].
149170
#[allow(clippy::type_complexity)]
150171
pub struct Drain<'a, K: IntKey, V> {
151172
count: &'a mut usize,

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use int::SealedInt;
2222
pub use entry::*;
2323
pub use int::Int;
2424
pub use int_key::IntKey;
25-
use iter::*;
25+
pub use iter::*;
2626

2727
// Test examples from the README.
2828
#[doc = include_str!("../README.md")]

0 commit comments

Comments
 (0)