rust-dense-bitset 0.1.1

Efficient and compact bitsets for Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/// Trait to define the basic functions of a `BitSet`
pub trait BitSet {
    /// Sets the value of the bit at position `position` to `value`
    fn set_bit(&mut self, position: usize, value: bool);

    /// Gets the value of the bit at position `position`
    fn get_bit(&self, position: usize) -> bool;

    /// Returns the bitset's Hamming weight
    fn get_weight(&self) -> u32;

    /// Resets the bitset
    fn reset(&mut self);

    /// Produces a string representation of the bitset (little endian), aligned with 64 bits and with leading zeroes
    fn to_string(self) -> String;
}