Skip to content

Commit 8b55230

Browse files
committed
Rename indexset to index_set and only re-export IndexSet
1 parent 7275c51 commit 8b55230

File tree

2 files changed

+27
-20
lines changed

2 files changed

+27
-20
lines changed

src/indexset.rs renamed to src/index_set.rs

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! A fixed-capacity hash set where the iteration order is independent of the hash values.
12
use core::{
23
borrow::Borrow,
34
fmt,
@@ -15,7 +16,7 @@ use crate::index_map::{self, IndexMap};
1516
///
1617
/// # Examples
1718
/// ```
18-
/// use heapless::FnvIndexSet;
19+
/// use heapless::index_set::FnvIndexSet;
1920
///
2021
/// // A hash set with a capacity of 16 elements allocated on the stack
2122
/// let mut books = FnvIndexSet::<_, 16>::new();
@@ -57,7 +58,7 @@ pub type FnvIndexSet<T, const N: usize> = IndexSet<T, BuildHasherDefault<FnvHash
5758
/// for this example.
5859
///
5960
/// ```
60-
/// use heapless::FnvIndexSet;
61+
/// use heapless::index_set::FnvIndexSet;
6162
///
6263
/// // A hash set with a capacity of 16 elements allocated on the stack
6364
/// let mut books = FnvIndexSet::<_, 16>::new();
@@ -103,7 +104,7 @@ impl<T, S, const N: usize> IndexSet<T, S, N> {
103104
/// # Examples
104105
///
105106
/// ```
106-
/// use heapless::FnvIndexSet;
107+
/// use heapless::index_set::FnvIndexSet;
107108
///
108109
/// let set = FnvIndexSet::<i32, 16>::new();
109110
/// assert_eq!(set.capacity(), 16);
@@ -117,7 +118,7 @@ impl<T, S, const N: usize> IndexSet<T, S, N> {
117118
/// # Examples
118119
///
119120
/// ```
120-
/// use heapless::FnvIndexSet;
121+
/// use heapless::index_set::FnvIndexSet;
121122
///
122123
/// let mut set = FnvIndexSet::<_, 16>::new();
123124
/// set.insert("a").unwrap();
@@ -153,7 +154,7 @@ impl<T, S, const N: usize> IndexSet<T, S, N> {
153154
/// # Examples
154155
///
155156
/// ```
156-
/// use heapless::FnvIndexSet;
157+
/// use heapless::index_set::FnvIndexSet;
157158
///
158159
/// let mut v: FnvIndexSet<_, 16> = FnvIndexSet::new();
159160
/// assert_eq!(v.len(), 0);
@@ -169,7 +170,7 @@ impl<T, S, const N: usize> IndexSet<T, S, N> {
169170
/// # Examples
170171
///
171172
/// ```
172-
/// use heapless::FnvIndexSet;
173+
/// use heapless::index_set::FnvIndexSet;
173174
///
174175
/// let mut v: FnvIndexSet<_, 16> = FnvIndexSet::new();
175176
/// assert!(v.is_empty());
@@ -185,7 +186,7 @@ impl<T, S, const N: usize> IndexSet<T, S, N> {
185186
/// # Examples
186187
///
187188
/// ```
188-
/// use heapless::FnvIndexSet;
189+
/// use heapless::index_set::FnvIndexSet;
189190
///
190191
/// let mut v: FnvIndexSet<_, 4> = FnvIndexSet::new();
191192
/// assert!(!v.is_full());
@@ -204,7 +205,7 @@ impl<T, S, const N: usize> IndexSet<T, S, N> {
204205
/// # Examples
205206
///
206207
/// ```
207-
/// use heapless::FnvIndexSet;
208+
/// use heapless::index_set::FnvIndexSet;
208209
///
209210
/// let mut v: FnvIndexSet<_, 16> = FnvIndexSet::new();
210211
/// v.insert(1).unwrap();
@@ -227,7 +228,7 @@ where
227228
/// # Examples
228229
///
229230
/// ```
230-
/// use heapless::FnvIndexSet;
231+
/// use heapless::index_set::FnvIndexSet;
231232
///
232233
/// let mut a: FnvIndexSet<_, 16> = [1, 2, 3].iter().cloned().collect();
233234
/// let mut b: FnvIndexSet<_, 16> = [4, 2, 3, 4].iter().cloned().collect();
@@ -264,7 +265,7 @@ where
264265
/// # Examples
265266
///
266267
/// ```
267-
/// use heapless::FnvIndexSet;
268+
/// use heapless::index_set::FnvIndexSet;
268269
///
269270
/// let mut a: FnvIndexSet<_, 16> = [1, 2, 3].iter().cloned().collect();
270271
/// let mut b: FnvIndexSet<_, 16> = [4, 2, 3, 4].iter().cloned().collect();
@@ -296,7 +297,7 @@ where
296297
/// # Examples
297298
///
298299
/// ```
299-
/// use heapless::FnvIndexSet;
300+
/// use heapless::index_set::FnvIndexSet;
300301
///
301302
/// let mut a: FnvIndexSet<_, 16> = [1, 2, 3].iter().cloned().collect();
302303
/// let mut b: FnvIndexSet<_, 16> = [4, 2, 3, 4].iter().cloned().collect();
@@ -328,7 +329,7 @@ where
328329
/// # Examples
329330
///
330331
/// ```
331-
/// use heapless::FnvIndexSet;
332+
/// use heapless::index_set::FnvIndexSet;
332333
///
333334
/// let mut a: FnvIndexSet<_, 16> = [1, 2, 3].iter().cloned().collect();
334335
/// let mut b: FnvIndexSet<_, 16> = [4, 2, 3, 4].iter().cloned().collect();
@@ -359,7 +360,7 @@ where
359360
/// # Examples
360361
///
361362
/// ```
362-
/// use heapless::FnvIndexSet;
363+
/// use heapless::index_set::FnvIndexSet;
363364
///
364365
/// let set: FnvIndexSet<_, 16> = [1, 2, 3].iter().cloned().collect();
365366
/// assert_eq!(set.contains(&1), true);
@@ -379,7 +380,7 @@ where
379380
/// # Examples
380381
///
381382
/// ```
382-
/// use heapless::FnvIndexSet;
383+
/// use heapless::index_set::FnvIndexSet;
383384
///
384385
/// let a: FnvIndexSet<_, 16> = [1, 2, 3].iter().cloned().collect();
385386
/// let mut b = FnvIndexSet::<_, 16>::new();
@@ -403,7 +404,7 @@ where
403404
/// # Examples
404405
///
405406
/// ```
406-
/// use heapless::FnvIndexSet;
407+
/// use heapless::index_set::FnvIndexSet;
407408
///
408409
/// let sup: FnvIndexSet<_, 16> = [1, 2, 3].iter().cloned().collect();
409410
/// let mut set = FnvIndexSet::<_, 16>::new();
@@ -427,7 +428,7 @@ where
427428
/// # Examples
428429
///
429430
/// ```
430-
/// use heapless::FnvIndexSet;
431+
/// use heapless::index_set::FnvIndexSet;
431432
///
432433
/// let sub: FnvIndexSet<_, 16> = [1, 2].iter().cloned().collect();
433434
/// let mut set = FnvIndexSet::<_, 16>::new();
@@ -457,7 +458,7 @@ where
457458
/// # Examples
458459
///
459460
/// ```
460-
/// use heapless::FnvIndexSet;
461+
/// use heapless::index_set::FnvIndexSet;
461462
///
462463
/// let mut set = FnvIndexSet::<_, 16>::new();
463464
///
@@ -480,7 +481,7 @@ where
480481
/// # Examples
481482
///
482483
/// ```
483-
/// use heapless::FnvIndexSet;
484+
/// use heapless::index_set::FnvIndexSet;
484485
///
485486
/// let mut set = FnvIndexSet::<_, 16>::new();
486487
///
@@ -629,6 +630,9 @@ impl<T> Clone for Iter<'_, T> {
629630
}
630631
}
631632

633+
/// An iterator over the difference of two `IndexSet`s.
634+
///
635+
/// This is created by the [`IndexSet::difference`] method.
632636
pub struct Difference<'a, T, S, const N: usize>
633637
where
634638
S: BuildHasher,
@@ -655,6 +659,9 @@ where
655659
}
656660
}
657661

662+
/// An iterator over the intersection of two `IndexSet`s.
663+
///
664+
/// This is created by the [`IndexSet::intersection`] method.
658665
pub struct Intersection<'a, T, S, const N: usize>
659666
where
660667
S: BuildHasher,

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ pub use binary_heap::BinaryHeap;
160160
pub use deque::Deque;
161161
pub use histbuf::{HistoryBuffer, OldestOrdered};
162162
pub use index_map::IndexMap;
163-
pub use indexset::{FnvIndexSet, IndexSet, Iter as IndexSetIter};
163+
pub use index_set::IndexSet;
164164
pub use len_type::LenType;
165165
pub use linear_map::LinearMap;
166166
pub use string::String;
@@ -174,7 +174,7 @@ mod test_helpers;
174174
pub mod deque;
175175
pub mod histbuf;
176176
pub mod index_map;
177-
mod indexset;
177+
pub mod index_set;
178178
mod len_type;
179179
pub mod linear_map;
180180
mod slice;

0 commit comments

Comments
 (0)