Crate id_set [−] [src]
IdSet
is a bitset implementation that stores data on the stack for small sizes (elements
less than 196) and keeps track of the element count.
Examples
The API is generally similar to that of the bit-set crate.
let mut set = IdSet::new(); set.insert(42); assert!(set.contains(42)); set.remove(42); assert_eq!(set.len(), 0);
Additionally the IdIter
struct provides iteration over the bits of any iterator over Block
values, allowing iteration over unions, intersections, and differences of arbitrarily many sets.
let a: IdSet = (0..15).collect(); let b: IdSet = (10..20).collect(); let c: IdSet = (0..5).collect(); assert_eq!(a.intersection(b.union(&c)).collect::<Vec<_>>(), a.intersection(&b).union(a.intersection(&c)).collect::<Vec<_>>());
Structs
BlockIter |
Represents a view into the blocks of a set or combination of sets. An iterator over the elements
can be obtained with |
Blocks |
An iterator over the blocks of the underlying representation. |
Difference |
Takes the difference of two block iterators. |
IdIter |
Transforms an iterator over blocks into an iterator over elements. |
IdSet |
A set of |
Intersection |
Takes the intersection of two block iterators. |
IntoBlocks |
A consuming iterator over the blocks of the underlying representation. |
IntoIter |
A consuming iterator over all elements in increasing order. |
Iter |
An iterator over all elements in increasing order. |
SymmetricDifference |
Takes the symmetric difference of two block iterators. |
Union |
Takes the union of two block iterators. |
Constants
BITS |
The number of bits in the block type. |
Traits
IntoBlockIterator |
Conversion into an iterator over blocks. |
Type Definitions
Block |
The block type of the underlying representation. |
Id |
The element type of the set. |