[−][src]Struct terminus_store::structure::bitarray::BitArray
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 bool
s.
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
Auto Trait Implementations
impl RefUnwindSafe for BitArray
impl Send for BitArray
impl Sync for BitArray
impl Unpin for BitArray
impl UnwindSafe for BitArray
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,