[][src]Type Definition solana_libra_vm_cache_map::CacheRefMap

type CacheRefMap<'a, K, V> = CacheMap<'a, K, V, &'a V>;

The most common case of CacheMap, where references to stored values are handed out.

Methods

impl<'a, K, V> CacheRefMap<'a, K, V> where
    K: Hash + PartialEq
[src]

pub fn or_insert(&self, key: K, value: V) -> &'a V[src]

Insert the value if not present. Discard the value if present.

The first value is picked to avoid multiple cached results floating around. This assumes that the cache is immutable (i.e. there's no invalidation).

Returns the address of the inserted value.

pub fn or_insert_with<F>(&self, key: K, insert: F) -> &'a V where
    F: FnOnce() -> V, 
[src]