pub struct ArrayStump<T, C>{ /* private fields */ }Expand description
The core data structure representing a two-level sorted stump.
Implementations§
Source§impl<T, C> ArrayStump<T, C>
impl<T, C> ArrayStump<T, C>
Sourcepub fn new(comparator: C) -> ArrayStump<T, C>
pub fn new(comparator: C) -> ArrayStump<T, C>
Creates a new ArrayStump instance.
Sourcepub fn new_explicit(comparator: C, init_capacity: u16) -> ArrayStump<T, C>
pub fn new_explicit(comparator: C, init_capacity: u16) -> ArrayStump<T, C>
Creates a new ArrayStump instance with explicit control over internal parameters.
Sourcepub fn remove_by_index(&mut self, idx: Index)
pub fn remove_by_index(&mut self, idx: Index)
Remove a value by its index.
Sourcepub fn get_by_index(&self, idx: Index) -> &T
pub fn get_by_index(&self, idx: Index) -> &T
Returns the element at a given index. Caution: An index that has been obtained before mutating the data structure is an invalid index. Calling this function with an invalid index may panic with index out of bounds.
Sourcepub fn next_index(&self, idx: Index) -> Option<Index>
pub fn next_index(&self, idx: Index) -> Option<Index>
Returns the index of the next element if there is one.
Sourcepub fn prev_index(&self, idx: Index) -> Option<Index>
pub fn prev_index(&self, idx: Index) -> Option<Index>
Returns the index of the previous element if there is one.
Sourcepub fn get_leaf_fill_ratio(&self) -> f64
pub fn get_leaf_fill_ratio(&self) -> f64
Get the average fill ratio of leafs, i.e., a value of 0.5 means that leafs are on average half full.
This is an O(1) operation.
Sourcepub fn get_leaf_fill_min(&self) -> Option<usize>
pub fn get_leaf_fill_min(&self) -> Option<usize>
Get the minimum number of elements in a leaf.
This requires iterating all blocks, and thus, is an O(sqrt N) operation.
Sourcepub fn get_leaf_fill_max(&self) -> Option<usize>
pub fn get_leaf_fill_max(&self) -> Option<usize>
Get the maximum number of elements in a leaf.
This requires iterating all blocks, and thus, is an O(sqrt N) operation.
Sourcepub fn get_capacity(&self) -> u16
pub fn get_capacity(&self) -> u16
Get the current max leaf capacity.
Sourcepub fn get_num_blocks(&self) -> usize
pub fn get_num_blocks(&self) -> usize
Get the current number of blocks.