Trait bitstring::fixed_bit_string::FixedBitString[][src]

pub trait FixedBitString {
Show 16 methods fn inc(&mut self, prefix: usize) -> bool;
fn len() -> usize;
fn get(&self, ndx: usize) -> bool;
fn set(&mut self, ndx: usize, bit: bool);
fn set_false_from(&mut self, ndx: usize);
fn is_false_from(&self, ndx: usize) -> bool;
fn set_true_from(&mut self, ndx: usize);
fn is_true_from(&self, ndx: usize) -> bool;
fn new_all_false() -> Self;
fn new_all_true() -> Self;
fn contains(&self, prefix: usize, other: &Self) -> bool; fn iter(&self, prefix: usize) -> Iter<Self>
Notable traits for Iter<B>
impl<B: FixedBitString + Clone> Iterator for Iter<B> type Item = B;

    where
        Self: Sized + Clone
, { ... }
fn on(&mut self, ndx: usize) { ... }
fn off(&mut self, ndx: usize) { ... }
fn flip(&mut self, ndx: usize) { ... }
fn shared_prefix_len(&self, other: &Self, max_len: usize) -> usize { ... }
}
Expand description

A bit string with fixed length.

All bits must me mutable, and there must be no dependencies between bits (i.e. setting one bit must not change any other bit).

Required methods

Treat bit string as integer, where bit 0 is the most significant bit.

Increment by one, i.e. start by incrementing the bit with the highest index.

Don’t touch first prefix bits; return true on overflow.

Panics

Should panic if prefix > self.len().

Length of the bit string in bits.

Get the ndxth bit.

Panics

Should panic if ndx >= self.len().

Set the ndxth bit to bit.

Panics

Should panic if ndx >= self.len().

Set all bits in [ndx..] to false.

Doesn’t do anything if ndx >= self.len().

Whether all bits in [ndx..] are false.

Returns true if ndx >= self.len().

Set all bits in [ndx..] to true.

Doesn’t do anything if ndx >= self.len().

Whether all bits in [ndx..] are true.

Returns true if ndx >= self.len().

New bit string with all bits set to false.

New bit string with all bits set to true.

check whether another bit string other shares the first prefix bits with self

Provided methods

Iterate through all bit strings until inc overflows.

All generated values will share the first prefix bits. If you want to iterate over all values make sure to call self.set_false_from(prefix) before.

Panics

Should panic if prefix > self.len().

Set the ndxth bit to true.

Panics

Should panic if ndx >= self.len().

Set the ndxth bit to false.

Panics

Should panic if ndx >= self.len().

Flips the ndxth bit.

Panics

Should panic if ndx >= self.len().

Length of the longest shared prefix of two bit strings.

Implementations on Foreign Types

Implementors