[][src]Struct terminus_store::structure::bitarray::BitArray

pub struct BitArray { /* fields omitted */ }

A thread-safe, reference-counted, compressed bit sequence.

A BitArray is a wrapper around a Bytes that provides a view of the underlying data as a compressed sequence of bits.

As with other types in structures, a BitArray is created from an existing buffer, rather than constructed from parts. The buffer may be read from a file or other source and may be very large. A BitArray preserves the buffer to save memory but provides a simple abstraction of being a vector of bools.

Implementations

impl BitArray[src]

pub fn from_bits(buf: Bytes) -> Result<BitArray, BitArrayError>[src]

Construct a BitArray by parsing a Bytes buffer.

pub fn bits(&self) -> &[u8][src]

Returns a reference to the buffer slice.

pub fn len(&self) -> usize[src]

Returns the number of usable bits in the bit array.

pub fn is_empty(&self) -> bool[src]

Returns true if there are no usable bits.

pub fn get(&self, index: usize) -> bool[src]

Reads the data buffer and returns the logical value of the bit at the bit index.

Panics if index is >= the length of the bit array.

Trait Implementations

impl Clone for BitArray[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,