Trait ccache::hashmap::user::Meta [−][src]
pub trait Meta<V>: Default { fn new() -> Self
where
Self: Sized; fn on_insert(
&mut self,
current_val: &mut V,
old_entry: Option<(&Self, &mut V)>
); fn on_get(&mut self, val: &mut V); }
The trait UserMeta defines operations that will be run on certain operations of the LRU
Required methods
fn new() -> Self where
Self: Sized,
[src]
Self: Sized,
create a new metadata struct with default values used if you don’t want to specify one on insert(…)
fn on_insert(&mut self, current_val: &mut V, old_entry: Option<(&Self, &mut V)>)
[src]
run every time the key is added or re-added as extra parameters you have:
- old_meta: ref to the old metadata. used when you are re-adding the same key, so that you can decide if you want to keep the old meta or start anew
- val: if somehow you need to modify the value every time we have an access
fn on_get(&mut self, val: &mut V)
[src]
run every time the key is requested
Implementors
Loading content...