pub struct BitString { /* private fields */ }Implementations§
Source§impl BitString
impl BitString
Sourcepub fn as_words(&self) -> &[u64]
pub fn as_words(&self) -> &[u64]
Returns the internal little-endian words.
Bit index i is stored in word i / 64, bit offset i % 64.
Unused high bits in the last word are guaranteed to be zero.
pub fn first(&self) -> Option<bool>
pub fn last(&self) -> Option<bool>
pub fn to_bool_vec(&self) -> Vec<bool>
Source§impl BitString
impl BitString
pub fn and_bits(&self, rhs: &Self) -> Result<Self, BitStringLenMismatch>
pub fn or_bits(&self, rhs: &Self) -> Result<Self, BitStringLenMismatch>
pub fn xor_bits(&self, rhs: &Self) -> Result<Self, BitStringLenMismatch>
pub fn not_bits(&self) -> Self
pub fn count_ones(&self) -> usize
pub fn count_zeros(&self) -> usize
pub fn shl_zeros(&self, amount: usize) -> Self
pub fn shr_zeros(&self, amount: usize) -> Self
Source§impl BitString
impl BitString
pub fn new() -> Self
pub fn repeat(value: bool, len: usize) -> Self
pub fn zeros(len: usize) -> Self
pub fn ones(len: usize) -> Self
Sourcepub fn from_words(words: &[u64], len: usize) -> Option<Self>
pub fn from_words(words: &[u64], len: usize) -> Option<Self>
Constructs a bit string from packed little-endian words.
The input must contain exactly enough words for len.
Unused high bits in the last word are masked out.
Source§impl BitString
impl BitString
pub fn set(&mut self, index: usize, value: bool) -> Option<bool>
pub fn push(&mut self, value: bool)
pub fn pop(&mut self) -> Option<bool>
pub fn truncate(&mut self, len: usize)
pub fn clear(&mut self)
pub fn insert(&mut self, index: usize, value: bool)
pub fn remove(&mut self, index: usize) -> bool
pub fn push_bits(&mut self, rhs: &Self)
pub fn insert_bits(&mut self, index: usize, rhs: &Self)
pub fn split_off(&mut self, at: usize) -> Self
pub fn replace_interval(&mut self, interval: UsizeCO, replacement: &Self)
pub fn drain_interval(&mut self, interval: UsizeCO) -> Self
pub fn retain<F>(&mut self, f: F)
Source§impl BitString
impl BitString
pub fn slice(&self, interval: UsizeCO) -> Self
pub fn slice_from(&self, start: usize) -> Self
pub fn slice_until(&self, end: usize) -> Self
Source§impl BitString
impl BitString
pub fn matches_at(&self, index: usize, pattern: &Self) -> bool
pub fn starts_with(&self, prefix: &Self) -> bool
pub fn ends_with(&self, suffix: &Self) -> bool
pub fn contains_bits(&self, needle: &Self) -> bool
pub fn find_bits(&self, needle: &Self) -> Option<usize>
pub fn rfind_bits(&self, needle: &Self) -> Option<usize>
pub fn strip_prefix(&self, prefix: &Self) -> Option<Self>
pub fn strip_suffix(&self, suffix: &Self) -> Option<Self>
Trait Implementations§
impl Eq for BitString
Source§impl<'a> Extend<&'a bool> for BitString
impl<'a> Extend<&'a bool> for BitString
Source§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = &'a bool>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = &'a bool>,
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl Extend<bool> for BitString
impl Extend<bool> for BitString
Source§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = bool>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = bool>,
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl FromIterator<bool> for BitString
impl FromIterator<bool> for BitString
Source§impl<'a> IntoIterator for &'a BitString
impl<'a> IntoIterator for &'a BitString
impl StructuralPartialEq for BitString
Auto Trait Implementations§
impl Freeze for BitString
impl RefUnwindSafe for BitString
impl Send for BitString
impl Sync for BitString
impl Unpin for BitString
impl UnsafeUnpin for BitString
impl UnwindSafe for BitString
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more