[][src]Struct indexed_bitvec_core::bits_ref::BitsRef

pub struct BitsRef<'a>(_);

Bits stored as a sequence of bytes (most significant bit first).

Methods

impl<'a> BitsRef<'a>
[src]

pub fn from_bytes(bytes: &'a [u8], len: u64) -> Option<Self>
[src]

pub fn all_bytes(self) -> &'a [u8]
[src]

All of the bytes stored in the byte sequence: not just the ones actually used.

pub fn len(self) -> u64
[src]

The number of bits used in the storage.

pub fn bytes(self) -> &'a [u8]
[src]

The used bytes of the byte sequence: bear in mind some of the bits in the last byte may be unused.

pub fn get(self, idx_bits: u64) -> Option<bool>
[src]

Get the byte at a specific index.

Returns None for out-of-bounds.

pub fn count_ones(self) -> u64
[src]

Count the set bits (O(n)).

pub fn count_zeros(self) -> u64
[src]

Count the unset bits (O(n)).

pub fn rank_ones(self, idx: u64) -> Option<u64>
[src]

Count the set bits before a position in the bits (O(n)).

Returns None it the index is out of bounds.

pub fn rank_zeros(self, idx: u64) -> Option<u64>
[src]

Count the unset bits before a position in the bits (O(n)).

Returns None it the index is out of bounds.

pub fn select_ones(self, target_rank: u64) -> Option<u64>
[src]

Find the position of a set bit by its rank (O(n)).

Returns None if no suitable bit is found. It is always the case otherwise that rank_ones(result) == Some(target_rank) and get(result) == Some(true).

pub fn select_zeros(self, target_rank: u64) -> Option<u64>
[src]

Find the position of an unset bit by its rank (O(n)).

Returns None if no suitable bit is found. It is always the case otherwise that rank_zeros(result) == Some(target_rank) and get(result) == Some(false).

Trait Implementations

impl<'a> Copy for BitsRef<'a>
[src]

impl<'a> Debug for BitsRef<'a>
[src]

impl<'a> PartialEq<BitsRef<'a>> for BitsRef<'a>
[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl<'a> Eq for BitsRef<'a>
[src]

impl<'a> Ord for BitsRef<'a>
[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl<'a> PartialOrd<BitsRef<'a>> for BitsRef<'a>
[src]

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<'a> From<BitsRef<'a>> for (&'a [u8], u64)
[src]

impl<'a> Clone for BitsRef<'a>
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<'a> Send for BitsRef<'a>

impl<'a> Sync for BitsRef<'a>

Blanket Implementations

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> From for T
[src]

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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