Trait cuml_map::CumlMap [−][src]
pub trait CumlMap { type Key; type Value; fn insert(&mut self, _: Self::Key, _: Self::Value); fn get_cuml(&self, _: Self::Key) -> Self::Value; fn get_single(&self, _: Self::Key) -> Self::Value; fn get_quantile(&self, _: Self::Value) -> Option<Self::Key>; }
Trait for building and querying mappings between keys and cumulative values.
Associated Types
Required Methods
fn insert(&mut self, _: Self::Key, _: Self::Value)
Insert an entry into the mapping.
fn get_cuml(&self, _: Self::Key) -> Self::Value
Get the cumulative value up to and including the specified key.
fn get_single(&self, _: Self::Key) -> Self::Value
Get the value at the specified key (not the cumulative value).
fn get_quantile(&self, _: Self::Value) -> Option<Self::Key>
Get the first key at which the cumulative value equals or exceeds the specified value, if such a key exists. Note that if the result of this function is only defined if the cumulative value is non-decreasing. If you start putting negative values into your mappings, you will get strange results from this function.
Implementors
impl<V> CumlMap for FenwickTree<V> where
V: Add<Output = V> + Sub<Output = V> + Zero + Copy + Ord, type Key = usize; type Value = V;impl<V> CumlMap for ExtensibleFenwickTree<V> where
V: Add<Output = V> + Sub<Output = V> + Zero + Copy + Ord + Debug, type Key = i64; type Value = V;impl<K, V> CumlMap for CumlTree<K, V> where
K: Add<Output = K> + Sub<Output = K> + Zero + Clone + Ord,
V: Add<Output = V> + Sub<Output = V> + Zero + Clone + Ord, type Key = K; type Value = V;