Skip to main content

Access

Trait 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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

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,

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>,