Trait bitstring::utils::BigEndianBitString [] [src]

pub trait BigEndianBitString: Sized {
    fn mask(ndx: usize) -> Self;
    fn inc(slice: &mut [Self], prefix: usize) -> bool;
    fn get(slice: &[Self], ndx: usize) -> bool;
    fn on(slice: &mut [Self], ndx: usize);
    fn off(slice: &mut [Self], ndx: usize);
    fn flip(slice: &mut [Self], ndx: usize);
    fn shared_prefix_len(
        slice: &[Self],
        other: &[Self],
        max_len: usize
    ) -> usize; fn set_false_from(slice: &mut [Self], ndx: usize); fn is_false_from(slice: &[Self], ndx: usize) -> bool; fn set_true_from(slice: &mut [Self], ndx: usize); fn is_true_from(slice: &[Self], ndx: usize) -> bool; fn contains(slice: &[Self], prefix: usize, other: &[Self]) -> bool; fn elembits() -> usize { ... } fn set(slice: &mut [Self], ndx: usize, bit: bool) { ... } }

Generic helper methods to treat [u*]-slices as big endian bit strings.

Required Methods

integer with single bit set. bit 0 is the highest bit (big endian). Wraps at Self::elembits().

increment from right; don't touch first prefix bits; returns true on overflow

Panics

Panics if prefix > Self::elembits() * slice.len().

Get the ndxth bit.

Panics

Panics if ndx >= Self::elembits() * slice.len().

Set the ndxth bit to true.

Panics

Panics if ndx >= Self::elembits() * slice.len().

Set the ndxth bit to false.

Panics

Panics if ndx >= Self::elembits() * slice.len().

Flips the ndxth bit.

Panics

Panics if ndx >= Self::elembits() * slice.len().

Length of the longest shared prefix of two bit strings.

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

Doesn't do anything if ndx >= Self::elembits() * slice.len().

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

Returns true if ndx >= Self::elembits() * slice.len().

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

Doesn't do anything if ndx >= Self::elembits() * slice.len().

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

Returns true if ndx >= Self::elembits() * slice.len().

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

Provided Methods

bits in a single element

Set the ndxth bit to bit.

Panics

Panics if ndx >= Self::elembits() * slice.len().

Implementors