Trait treap_map::KeyMngTrait
source · pub trait KeyMngTrait<C: TreapMapConfig>: Default {
// Required methods
fn view_update(
&mut self,
key: &C::SearchKey,
value: Option<&C::Value>,
old_value: Option<&C::Value>
);
fn len(&self) -> usize;
fn get_sort_key(&self, key: &C::SearchKey) -> Option<C::SortKey>;
fn make_sort_key(&self, key: &C::SearchKey, value: &C::Value) -> C::SortKey;
}
Expand description
Searching in Treap
requires sort key. This trait manages the relationship
among sort keys, search keys and values in a Treap. This is necessary when
the sort key is not directly derivable from the search key or is not a null
element.
Required Methods§
sourcefn view_update(
&mut self,
key: &C::SearchKey,
value: Option<&C::Value>,
old_value: Option<&C::Value>
)
fn view_update( &mut self, key: &C::SearchKey, value: Option<&C::Value>, old_value: Option<&C::Value> )
Invoked when a new key-value pair is changed in the Treap.
sourcefn get_sort_key(&self, key: &C::SearchKey) -> Option<C::SortKey>
fn get_sort_key(&self, key: &C::SearchKey) -> Option<C::SortKey>
Retrieve the sort key for a given search key.
Returns None
if the search key is not in the treap.
sourcefn make_sort_key(&self, key: &C::SearchKey, value: &C::Value) -> C::SortKey
fn make_sort_key(&self, key: &C::SearchKey, value: &C::Value) -> C::SortKey
Generate the sort key from a key-value pair.
Object Safety§
This trait is not object safe.