Trait arc_swap::cache::Access

source ·
pub trait Access<T> {
    // Required method
    fn load(&mut self) -> &T;
}
Expand description

Generalization of caches providing access to T.

This abstracts over all kinds of caches that can provide a cheap access to values of type T. This is useful in cases where some code doesn’t care if the T is the whole structure or just a part of it.

See the example at Cache::map.

Required Methods§

source

fn load(&mut self) -> &T

Loads the value from cache.

This revalidates the value in the cache, then provides the access to the cached value.

Implementors§

source§

impl<A, T, S> Access<<T as Deref>::Target> for Cache<A, T>where A: Deref<Target = ArcSwapAny<T, S>>, T: Deref<Target = <T as RefCnt>::Base> + RefCnt, S: Strategy<T>,

source§

impl<A, T, S, F, U> Access<U> for MapCache<A, T, F>where A: Deref<Target = ArcSwapAny<T, S>>, T: RefCnt, S: Strategy<T>, F: FnMut(&T) -> &U,