pub struct BitArray {
pub size: i64,
pub bit_array: Vec<u8>,
}
Expand description
A structure aimed to bring the bitarray functionality. Structure is described within two fields. “size” - The number of bits that will be allocated during the struct instance initialization. “bit_array” - The vector of 8 bit integer used to represent bits where each 8 bits are packed in every 8 bit integer.
use bitarray_naive::BitArray;
let bitarray_size: i64 = 9999;
let mut bitarray: BitArray = BitArray::new(bitarray_size);
bitarray.set(12, true).unwrap();
assert_eq!(bitarray.get(12).unwrap(), true);
Fields§
§size: i64
§bit_array: Vec<u8>
Implementations§
Source§impl BitArray
impl BitArray
Sourcepub fn new(size: i64) -> Self
pub fn new(size: i64) -> Self
Constructor used to initialize a new instance of the bitarray with a given size. “size” - The number of bits that will be allocated during the struct instance initialization.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for BitArray
impl<'de> Deserialize<'de> for BitArray
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
Auto Trait Implementations§
impl Freeze for BitArray
impl RefUnwindSafe for BitArray
impl Send for BitArray
impl Sync for BitArray
impl Unpin for BitArray
impl UnwindSafe for BitArray
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