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§

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.

Sets either true or false value in bit array at given position.

Gets either true or false value in bit array at given position.

Trait Implementations§

Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.