pub struct BitArray<const BYTES: usize> { /* private fields */ }
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.
Implementations
sourceimpl<const BYTES: usize> BitArray<BYTES>
impl<const BYTES: usize> BitArray<BYTES>
sourcepub fn get(&self, bit_index: usize) -> bool
pub fn get(&self, bit_index: usize) -> bool
Returns the value of a bit at the provided bit index
sourcepub fn set(&mut self, bit_index: usize, value: bool)
pub fn set(&mut self, bit_index: usize, value: bool)
Sets the value of a bit at the provided bit index
sourcepub fn serialize(&self, cursor: &mut WriteCursor<'_>)
pub fn serialize(&self, cursor: &mut WriteCursor<'_>)
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.
sourcepub fn deserialize_in_place(&mut self, cursor: &mut ReadCursor<'_>)
pub fn deserialize_in_place(&mut self, cursor: &mut ReadCursor<'_>)
Deserializes this bit set (not including the length). self.bit_length must be set before this function is called.
sourcepub fn deserialize(
bit_length: usize,
cursor: &mut ReadCursor<'_>
) -> BitArray<BYTES>
pub fn deserialize(
bit_length: usize,
cursor: &mut ReadCursor<'_>
) -> BitArray<BYTES>
Deserializes a bit set
bit_length
is the number of bits that should be read from the cursor.
Trait Implementations
sourceimpl<const BYTES: usize> IntoIterator for BitArray<BYTES>
impl<const BYTES: usize> IntoIterator for BitArray<BYTES>
sourceimpl<'a, const BYTES: usize> IntoIterator for &'a BitArray<BYTES>
impl<'a, const BYTES: usize> IntoIterator for &'a BitArray<BYTES>
sourceimpl<const LBYTES: usize> Ord for BitArray<LBYTES>
impl<const LBYTES: usize> Ord for BitArray<LBYTES>
sourceimpl<const LBYTES: usize, const RBYTES: usize> PartialEq<BitArray<RBYTES>> for BitArray<LBYTES>
impl<const LBYTES: usize, const RBYTES: usize> PartialEq<BitArray<RBYTES>> for BitArray<LBYTES>
sourceimpl<const LBYTES: usize, const RBYTES: usize> PartialOrd<BitArray<RBYTES>> for BitArray<LBYTES>
impl<const LBYTES: usize, const RBYTES: usize> PartialOrd<BitArray<RBYTES>> for BitArray<LBYTES>
sourcefn partial_cmp(&self, other: &BitArray<RBYTES>) -> Option<Ordering>
fn partial_cmp(&self, other: &BitArray<RBYTES>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<const LBYTES: usize> Eq for BitArray<LBYTES>
Auto Trait Implementations
impl<const BYTES: usize> RefUnwindSafe for BitArray<BYTES>
impl<const BYTES: usize> Send for BitArray<BYTES>
impl<const BYTES: usize> Sync for BitArray<BYTES>
impl<const BYTES: usize> Unpin for BitArray<BYTES>
impl<const BYTES: usize> UnwindSafe for BitArray<BYTES>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more