[−][src]Struct array_stump::ArrayStump
The core data structure representing a two-level sorted stump.
Implementations
impl<T, C> ArrayStump<T, C> where
C: Fn(&T, &T) -> Ordering,
T: Clone,
T: Debug,
[src]
C: Fn(&T, &T) -> Ordering,
T: Clone,
T: Debug,
pub fn new(comparator: C) -> ArrayStump<T, C>
[src]
Creates a new ArrayStump
instance.
pub fn new_explicit(comparator: C, init_capacity: u16) -> ArrayStump<T, C>
[src]
Creates a new ArrayStump
instance with explicit control over internal parameters.
pub fn len(&self) -> usize
[src]
Returns the length (i.e., number of elements stored).
pub fn insert(&mut self, t: T) -> Option<Index>
[src]
Insert a value.
pub fn remove(&mut self, t: &T) -> bool
[src]
Remove a value.
pub fn remove_by_index(&mut self, idx: Index)
[src]
Remove a value by its index.
pub fn find(&self, t: &T) -> Option<Index>
[src]
Try to find an existing value.
pub fn get_by_index(&self, idx: Index) -> &T
[src]
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.
pub fn next_index(&self, idx: Index) -> Option<Index>
[src]
Returns the index of the next element if there is one.
pub fn prev_index(&self, idx: Index) -> Option<Index>
[src]
Returns the index of the previous element if there is one.
pub fn min(&self) -> Option<&T>
[src]
Returns the minimum value.
pub fn max(&self) -> Option<&T>
[src]
Returns the maximum value.
pub fn traverse<F>(&self, f: F) where
F: FnMut(usize, &T),
[src]
F: FnMut(usize, &T),
Traverse collection given a callback.
pub fn collect(&self) -> Vec<T>
[src]
Collect collection into a vector.
pub fn get_leaf_fill_ratio(&self) -> f64
[src]
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.
pub fn get_leaf_fill_min(&self) -> Option<usize>
[src]
Get the minimum number of elements in a leaf.
This requires iterating all blocks, and thus, is an O(sqrt N) operation.
pub fn get_leaf_fill_max(&self) -> Option<usize>
[src]
Get the maximum number of elements in a leaf.
This requires iterating all blocks, and thus, is an O(sqrt N) operation.
pub fn get_capacity(&self) -> u16
[src]
Get the current max leaf capacity.
pub fn get_num_blocks(&self) -> usize
[src]
Get the current number of blocks.
pub fn debug(&self)
[src]
Internal debug helper function.
pub fn debug_order(&self)
[src]
pub fn fix_index(&self, transition: IndexTransition, idx: Index) -> Index
[src]
pub fn wiggle(&mut self, idx: Index) -> Option<IndexTransition>
[src]
Auto Trait Implementations
impl<T, C> RefUnwindSafe for ArrayStump<T, C> where
C: RefUnwindSafe,
T: RefUnwindSafe,
C: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, C> Send for ArrayStump<T, C> where
C: Send,
T: Send,
C: Send,
T: Send,
impl<T, C> Sync for ArrayStump<T, C> where
C: Sync,
T: Sync,
C: Sync,
T: Sync,
impl<T, C> Unpin for ArrayStump<T, C> where
C: Unpin,
T: Unpin,
C: Unpin,
T: Unpin,
impl<T, C> UnwindSafe for ArrayStump<T, C> where
C: UnwindSafe,
T: UnwindSafe,
C: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,