Struct bitstring::BitLengthString
[−]
[src]
pub struct BitLengthString<W: FixedBitString> { /* fields omitted */ }
Extend a
FixedBitString
to a
BitString
by also storing a
length.
Methods
impl<W: FixedBitString> BitLengthString<W>
[src]
fn new(bits: W, len: usize) -> Self
Create new dynamic-length bit string from fixed bit string and a length.
The bits in bits
after len
bits are set to false.
Panics
Panics if len > W::len()
.
fn contains(&self, bits: &W) -> bool
check whether another bit string bits
is prefixed by self
fn bits(&self) -> &W
get read access to the bits
fn len(&self) -> usize
length of bit string (same as
BitString::len()
)
Trait Implementations
impl<W: Clone + FixedBitString> Clone for BitLengthString<W>
[src]
fn clone(&self) -> BitLengthString<W>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<W: Debug + FixedBitString> Debug for BitLengthString<W>
[src]
impl<W: Hash + FixedBitString> Hash for BitLengthString<W>
[src]
fn hash<__HW: Hasher>(&self, __arg_0: &mut __HW)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<W: FixedBitString> BitString for BitLengthString<W>
[src]
fn get(&self, ndx: usize) -> bool
Get the ndx
th bit. Read more
fn set(&mut self, ndx: usize, bit: bool)
Set the ndx
th bit to bit
. Read more
fn flip(&mut self, ndx: usize)
Flips the ndx
th bit. Read more
fn len(&self) -> usize
Current length of the bit string in bits.
fn clip(&mut self, len: usize)
Set current length to len
. Read more
fn append(&mut self, bit: bool)
Append a bit. Read more
fn null() -> Self
Create a new zero-length bit string. Read more
Length of the longest shared prefix of two bit strings.
Longest shared prefix of two bit strings.
fn subset_cmp(&self, other: &Self) -> Option<Ordering>
Partial ordering on bit strings. Read more
fn lexicographic_cmp(&self, other: &Self) -> Ordering
Lexicographic ordering on bit strings. Read more
impl<W: FixedBitString> Default for BitLengthString<W>
[src]
impl<W: FixedBitString> Ord for BitLengthString<W>
[src]
fn cmp(&self, rhs: &Self) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl<W: FixedBitString> PartialOrd for BitLengthString<W>
[src]
fn partial_cmp(&self, rhs: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<W: FixedBitString> PartialEq for BitLengthString<W>
[src]
fn eq(&self, rhs: &Self) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.