pub struct AutoMap<K: Eq + Hash + Clone + Display, V: PartialEq + Clone + 'static> { /* private fields */ }
Expand description
A structure similar to HashMap
but allows to provide a function create
for creating a new value if particular key doesn’t exists.
Such a function can for example fetch data from internet.
use vertigo::AutoMap;
let my_map = AutoMap::<i32, i32>::new(|x| x*2);
assert_eq!(my_map.get_value(&5), 10);
Implementations
Trait Implementations
Auto Trait Implementations
impl<K, V> !RefUnwindSafe for AutoMap<K, V>
impl<K, V> !UnwindSafe for AutoMap<K, V>
Blanket Implementations
Mutably borrows from an owned value. Read more