pub struct BitArray<const BYTES: usize> { /* fields omitted */ }
Expand description
An array of bits in a format compatible with UAVCAN serialization
Because the const generics feature is incomplete, the integer generic parameter is a number
of bytes (= 8 bits), not a number of bits. The functions still use bit indexes.
impl<const BYTES: usize> BitArray<BYTES>
pub fn new(bit_length: usize) -> Self
Creates a bit set with all bits set to zero
pub fn len(&self) -> usize
Returns the number of bits in this array
Returns true if this array is empty
pub fn get(&self, bit_index: usize) -> bool
Returns the value of a bit at the provided bit index
pub fn set(&mut self, bit_index: usize, value: bool)
Sets the value of a bit at the provided bit index
pub fn fill(&mut self, value: bool)
Sets all bits in this array to the specified value
Serializes this bit set (not including the length)
Note: This type doesn’t implement DataType, Serialize, or Deserialize because it is not a
composite type and has an alignment of only 1 bit.
Deserializes this bit set (not including the length). self.bit_length must be set
before this function is called.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
fn eq(&self, other: &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
This method tests for !=
.
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.