pub trait BitSet<T> {
// Required methods
fn capacity(&self) -> T;
fn has(&self, _: T) -> bool;
fn is_empty(&self) -> bool;
fn size(&self) -> T;
}
Expand description
A trait for reading values from a bit set.
Required Methods§
Sourcefn capacity(&self) -> T
fn capacity(&self) -> T
Returns the number of bits that can be stored in the set.
§Example
use index_set::BitSet;
let bitset: &[u32] = &[0; 4];
assert_eq!(bitset.capacity(), 128);
Sourcefn has(&self, _: T) -> bool
fn has(&self, _: T) -> bool
Returns true
if the set contains the given value.
§Example
use index_set::{BitSet, BitSetMut};
let mut bitset: [u32; 4] = [0; 4];
bitset.insert(0);
assert!(bitset.has(0));