Struct bitmaptrie::CompVec
[−]
[src]
pub struct CompVec<T> { // some fields omitted }
A simple sparse vector. The valid
word is a bitmap of which indeces
have values. The maximum size of this vector is equal to the number of
bits in a word (32 or 64).
Methods
impl<T> CompVec<T>
[src]
fn set(&mut self, index: usize, value: T) -> &mut T
Move a value into the node at the given index. Returns a reference to the location where the value is stored.
fn get_mut(&mut self, index: usize) -> Option<&mut T>
Return the mutable value at the given index if it exists, otherwise return None.
fn get(&self, index: usize) -> Option<&T>
Return the value at the given index if it exists, otherwise return None.
fn get_default_mut<F>(&mut self, index: usize, default: F) -> &mut T where F: Fn() -> T
Return the value at the given index if it exists, otherwise call the provided function to get the default value to insert and return.
fn remove(&mut self, index: usize) -> Option<T>
Remove an entry, returning the entry if it was present at the given index.
fn size(&self) -> usize
Number of objects stored.
fn capacity(&self) -> usize
Number of objects that can be stored without reallocation.
fn is_empty(&self) -> bool
Return true if the vector is empty.
fn next(&self, masked_valid: usize, compressed: usize) -> Option<((usize, usize), (usize, &T))>
Return the next Some(((masked_valid, compressed), (index, &value))) or None
masked_valid
is the last valid bitmap with already-visited indeces
masked out, starts with std::usize::MAX for the first call.
compressed
is the last compressed vector index, always starting
at zero for the first call.
fn next_mut(&mut self, masked_valid: usize, compressed: usize) -> Option<((usize, usize), (usize, &mut T))>
Return the next Some(((masked_valid, compressed), (index, &mut value))) or None
masked_valid
is the last valid bitmap with already-visited indeces
masked out, starts with std::usize::MAX for the first call.
compressed
is the last compressed vector index, always starting
at zero for the first call.
fn iter(&self) -> Iter<T>
Create an iterator over the contents