[][src]Struct succinct::BitVector

pub struct BitVector<Block: BlockType = usize>(_);

Uncompressed vector of bits.

Methods

impl<Block: BlockType> BitVector<Block>[src]

pub fn new() -> Self[src]

Creates a new, empty bit vector.

pub fn with_capacity(capacity: u64) -> Self[src]

Creates a new, empty bit vector with space allocated for capacity bits.

Panics

Panics if capacity is too large. In particular the number of blocks required by the capacity (capacity / Block::nbits()) must fit in a usize.

pub fn block_with_capacity(capacity: usize) -> Self[src]

Creates a new, empty bit vector with space allocated for capacity blocks.

pub fn with_fill(len: u64, value: bool) -> Self[src]

Creates a new bit vector of len bits initialized to value.

Panics

Panics if len is too large. In particular the number of blocks required by the capacity (len / Block::nbits()) must fit in a usize.

pub fn block_with_fill(block_len: usize, value: Block) -> Self[src]

Creates a new bit vector of block_len blocks initialized to value.

pub fn capacity(&self) -> u64[src]

How many bits the bit vector can hold without reallocating.

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

How many blocks the bit vector can hold without reallocating.

pub fn resize(&mut self, new_len: u64, value: bool)[src]

Resizes the bit vector to the given number of elements, filling if necessary.

Panics

Panics if new_len is too large. In particular the number of blocks required by the capacity (new_len / Block::nbits()) must fit in a usize.

pub fn block_resize(&mut self, new_len: usize, value: Block)[src]

Resizes the bit vector to the given number of blocks, filling if necessary.

pub fn reserve(&mut self, additional: u64)[src]

Reserves capacity for at least additional more bits to be inserted.

The collection may reserve more space to avoid frequent reallocations.

Panics

Panics if the number of blocks overflows a usize.

pub fn block_reserve(&mut self, additional: usize)[src]

Reserves capacity for at least additional blocks of bits to be inserted.

The collection may reserve more space to avoid frequent reallocations.

Panics

Panics if the number of blocks overflows a usize.

pub fn reserve_exact(&mut self, additional: u64)[src]

Reserves capacity for at least additional more bits to be inserted.

Unlike reserve, does nothing if the capacity is already sufficient.

Panics

Panics if the number of blocks overflows a usize.

pub fn block_reserve_exact(&mut self, additional: usize)[src]

Reserves capacity for at least additional more blocks of bits to be inserted.

Unlike reserve_block, does nothing if the capacity is already sufficient.

Panics

Panics if the number of blocks overflows a usize.

pub fn shrink_to_fit(&mut self)[src]

Shrinks the capacity to just fit the number of elements.

pub fn truncate(&mut self, len: u64)[src]

Shrinks to the given size.

Does nothing if len is greater than the current size.

pub fn block_truncate(&mut self, block_len: usize)[src]

Shrinks to the given size in blocks.

Does nothing if block_len is greater than the current size in blocks.

pub fn clear(&mut self)[src]

Sets the size to 0 while retaining the allocated storage.

Important traits for Iter<'a, Block>
pub fn iter(&self) -> Iter<Block>[src]

Returns an iterator over the bits of the bit vector

Trait Implementations

impl<Block: BlockType> SpaceUsage for BitVector<Block>[src]

fn total_bytes(&self) -> usize[src]

Computes the size of the receiver in bytes. Read more

fn stack_bytes() -> usize[src]

Calculates the stack portion of the size of this type. Read more

impl<Block: BlockType> BitVec for BitVector<Block>[src]

type Block = Block

The underlying block type used to store the bits of the vector.

fn block_len(&self) -> usize[src]

The length of the slice in blocks.

fn get_bits(&self, start: u64, count: usize) -> Self::Block[src]

Gets count bits starting at bit index start, interpreted as a little-endian integer. Read more

impl<Block: BlockType> BitVecMut for BitVector<Block>[src]

fn set_bits(&mut self, start: u64, count: usize, value: Self::Block)[src]

Sets count bits starting at bit index start, interpreted as a little-endian integer. Read more

impl<Block: BlockType> BitVecPush for BitVector<Block>[src]

fn align_block(&mut self, value: bool)[src]

Pushes value 0 or more times until the size of the bit vector is block-aligned. Read more

impl<Block: Ord + BlockType> Ord for BitVector<Block>[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

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

Restrict a value to a certain interval. Read more

impl<Block: PartialOrd + BlockType> PartialOrd<BitVector<Block>> for BitVector<Block>[src]

impl<Block: PartialEq + BlockType> PartialEq<BitVector<Block>> for BitVector<Block>[src]

impl<Block: BlockType> Default for BitVector<Block>[src]

impl<'a, Block: BlockType + 'a> IntoIterator for &'a BitVector<Block>[src]

type Item = bool

The type of the elements being iterated over.

type IntoIter = Iter<'a, Block>

Which kind of iterator are we turning this into?

impl<Block: Clone + BlockType> Clone for BitVector<Block>[src]

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

Performs copy-assignment from source. Read more

impl<Block: Eq + BlockType> Eq for BitVector<Block>[src]

impl<Block: Debug + BlockType> Debug for BitVector<Block>[src]

impl<Block: Hash + BlockType> Hash for BitVector<Block>[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<Block: BlockType> Binary for BitVector<Block>[src]

Auto Trait Implementations

impl<Block> Send for BitVector<Block> where
    Block: Send

impl<Block> Unpin for BitVector<Block> where
    Block: Unpin

impl<Block> Sync for BitVector<Block> where
    Block: Sync

impl<Block> RefUnwindSafe for BitVector<Block> where
    Block: RefUnwindSafe

impl<Block> UnwindSafe for BitVector<Block> where
    Block: UnwindSafe

Blanket Implementations

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

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

type Owned = T

The resulting type after obtaining ownership.

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

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<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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