Struct succinct::BitVector
[−]
[src]
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: Clone + BlockType> Clone for BitVector<Block>
[src]
fn clone(&self) -> BitVector<Block>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<Block: Debug + BlockType> Debug for BitVector<Block>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<Block: Eq + BlockType> Eq for BitVector<Block>
[src]
impl<Block: PartialEq + BlockType> PartialEq for BitVector<Block>
[src]
fn eq(&self, __arg_0: &BitVector<Block>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &BitVector<Block>) -> bool
[src]
This method tests for !=
.
impl<Block: Ord + BlockType> Ord for BitVector<Block>
[src]
fn cmp(&self, __arg_0: &BitVector<Block>) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
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<Block: PartialOrd + BlockType> PartialOrd for BitVector<Block>
[src]
fn partial_cmp(&self, __arg_0: &BitVector<Block>) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &BitVector<Block>) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &BitVector<Block>) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &BitVector<Block>) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &BitVector<Block>) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<Block: Hash + BlockType> Hash for BitVector<Block>
[src]
fn hash<__HBlock: Hasher>(&self, __arg_0: &mut __HBlock)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. 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 bit_len(&self) -> u64
[src]
The length of the slice in bits.
fn get_bit(&self, index: u64) -> bool
[src]
Gets the bit at position
Read more
fn get_block(&self, index: usize) -> Block
[src]
Gets the block at position
Read more
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_bit(&mut self, index: u64, value: bool)
[src]
Sets the bit at position
to value
. Read more
fn set_block(&mut self, index: usize, value: Block)
[src]
Sets the block at position
to value
. Read more
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 push_bit(&mut self, value: bool)
[src]
Adds the given bit to the end of the bit vector.
fn pop_bit(&mut self) -> Option<bool>
[src]
Removes and returns the last bit, if any.
fn push_block(&mut self, value: Block)
[src]
Pushes the given block onto the end of the bit vector. Read more
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: BlockType> Binary for BitVector<Block>
[src]
fn fmt(&self, formatter: &mut Formatter) -> Result
[src]
Formats the value using the given formatter.
impl<Block: BlockType> SpaceUsage for BitVector<Block>
[src]
fn is_stack_only() -> bool
[src]
Is the size of this type known statically? Read more
fn heap_bytes(&self) -> usize
[src]
Calculates the heap portion of the size of an object. Read more
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