Struct fixedbitset::FixedBitSet [] [src]

pub struct FixedBitSet {
    // some fields omitted
}

FixedBitSet is a simple fixed size set of bits that can be enabled (1 / true) or disabled (0 / false).

Methods

impl FixedBitSet

fn with_capacity(bits: usize) -> Self

Create a new FixedBitSet with a specific number of bits, all initially clear.

fn grow(&mut self, bits: usize)

Grow capacity to bits, all new bits initialized to zero

fn len(&self) -> usize

Return the length of the FixedBitSet in bits.

fn contains(&self, bit: usize) -> bool

Return true if the bit is enabled in the FixedBitSet, false otherwise.

Note: bits outside the capacity are always disabled.

fn clear(&mut self)

Clear all bits.

fn insert(&mut self, bit: usize)

Panics if bit is out of bounds.

fn set(&mut self, bit: usize, enabled: bool)

Panics if bit is out of bounds.

fn as_slice(&self) -> &[u32]

View the bitset as a slice of u32 blocks

fn as_mut_slice(&mut self) -> &mut [u32]

View the bitset as a mutable slice of u32 blocks. Writing past the bitlength in the last will cause contains to return potentially incorrect results for bits past the bitlength.

Trait Implementations

impl Clone for FixedBitSet

fn clone(&self) -> Self

1.0.0fn clone_from(&mut self, source: &Self)

impl Index<usize> for FixedBitSet

Return true if the bit is enabled in the bitset, or false otherwise.

type Output = bool

fn index(&self, bit: usize) -> &bool

Derived Implementations

impl Hash for FixedBitSet

fn hash<__H: Hasher>(&self, __arg_0: &mut __H)

1.3.0fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher

impl Ord for FixedBitSet

fn cmp(&self, __arg_0: &FixedBitSet) -> Ordering

impl PartialOrd for FixedBitSet

fn partial_cmp(&self, __arg_0: &FixedBitSet) -> Option<Ordering>

fn lt(&self, __arg_0: &FixedBitSet) -> bool

fn le(&self, __arg_0: &FixedBitSet) -> bool

fn gt(&self, __arg_0: &FixedBitSet) -> bool

fn ge(&self, __arg_0: &FixedBitSet) -> bool

impl Eq for FixedBitSet

impl PartialEq for FixedBitSet

fn eq(&self, __arg_0: &FixedBitSet) -> bool

fn ne(&self, __arg_0: &FixedBitSet) -> bool

impl Debug for FixedBitSet

fn fmt(&self, __arg_0: &mut Formatter) -> Result