pub struct BitArray<T: BitStorage> { /* private fields */ }Expand description
Array of booleans as a large bit vector
Implementations§
Source§impl<T: BitStorage> BitArray<T>
impl<T: BitStorage> BitArray<T>
Sourcepub fn new(size: usize) -> Self
pub fn new(size: usize) -> Self
Create a new bit array where the size is the expected number of bits.
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Empty vector with some bytes allocated, where the size of the memory allocated depends on the underlying integer size used.
Sourcepub fn all_zeroes(&self) -> bool
pub fn all_zeroes(&self) -> bool
Indicates if none of the bits are set
Sourcepub fn iter(&self) -> BitArrayIterator<'_, T> ⓘ
pub fn iter(&self) -> BitArrayIterator<'_, T> ⓘ
Iterate over the bits in the array
Sourcepub fn get(&self, index: usize) -> bool
pub fn get(&self, index: usize) -> bool
Get the bit value from a given index
§Panic
This will panic if index points to a value beyond the number of bits stored in this array.
Sourcepub fn set(&mut self, index: usize, value: bool)
pub fn set(&mut self, index: usize, value: bool)
Set the bit value at a given index
§Panic
This will panic if index points to a value beyond the number of bits stored in this array.
Trait Implementations§
Source§impl<'de, T: BitStorage> Deserialize<'de> for BitArray<T>
impl<'de, T: BitStorage> Deserialize<'de> for BitArray<T>
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T: BitStorage> Display for BitArray<T>
impl<T: BitStorage> Display for BitArray<T>
Source§impl<T: BitStorage> FromStr for BitArray<T>
impl<T: BitStorage> FromStr for BitArray<T>
Source§impl<'a, T: BitStorage + 'a> IntoIterator for &'a BitArray<T>
impl<'a, T: BitStorage + 'a> IntoIterator for &'a BitArray<T>
Source§impl<T: BitStorage> IntoIterator for BitArray<T>
impl<T: BitStorage> IntoIterator for BitArray<T>
Source§impl<T: BitStorage> Serialize for BitArray<T>
impl<T: BitStorage> Serialize for BitArray<T>
impl<T: Eq + BitStorage> Eq for BitArray<T>
impl<T: BitStorage> StructuralPartialEq for BitArray<T>
Auto Trait Implementations§
impl<T> Freeze for BitArray<T>
impl<T> RefUnwindSafe for BitArray<T>where
T: RefUnwindSafe,
impl<T> Send for BitArray<T>
impl<T> Sync for BitArray<T>
impl<T> Unpin for BitArray<T>where
T: Unpin,
impl<T> UnsafeUnpin for BitArray<T>
impl<T> UnwindSafe for BitArray<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more