pub struct Sums<K, V: Item> { /* private fields */ }Expand description
Items by key, each prefix’s summary in log time.
Implementations§
Source§impl<K: Ord + Clone, V: Item> Sums<K, V>
impl<K: Ord + Clone, V: Item> Sums<K, V>
pub fn new() -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn get(&self, key: &K) -> Option<&V>
Sourcepub fn insert(&mut self, key: K, value: V) -> Option<V>
pub fn insert(&mut self, key: K, value: V) -> Option<V>
Puts value at key, replacing what was there; returns it.
Sourcepub fn seek(
&self,
reaches: impl Fn(&V::Sum) -> bool,
) -> Option<(&K, &V, V::Sum)>
pub fn seek( &self, reaches: impl Fn(&V::Sum) -> bool, ) -> Option<(&K, &V, V::Sum)>
The first item whose prefix — the summary of it and everything before
it — reaches, which must be false and then true along the items;
with the summary of everything before it.
Trait Implementations§
Auto Trait Implementations§
impl<K, V> Freeze for Sums<K, V>
impl<K, V> RefUnwindSafe for Sums<K, V>
impl<K, V> Send for Sums<K, V>
impl<K, V> Sync for Sums<K, V>
impl<K, V> Unpin for Sums<K, V>
impl<K, V> UnsafeUnpin for Sums<K, V>
impl<K, V> UnwindSafe for Sums<K, V>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more