Trait arc_swap::access::Access

source ·
pub trait Access<T> {
    type Guard: Deref<Target = T>;

    // Required method
    fn load(&self) -> Self::Guard;
}
Expand description

Abstracts over ways code can get access to a value of type T.

This is the trait that parts of code will use when accessing a subpart of the big data structure. See the module documentation for details.

Required Associated Types§

source

type Guard: Deref<Target = T>

A guard object containing the value and keeping it alive.

For technical reasons, the library doesn’t allow direct access into the stored value. A temporary guard object must be loaded, that keeps the actual value alive for the time of use.

Required Methods§

source

fn load(&self) -> Self::Guard

The loading method.

This returns the guard that holds the actual value. Should be called anew each time a fresh value is needed.

Implementors§

source§

impl<A, F, T, R> Access<R> for Map<A, T, F>
where A: Access<T>, F: Fn(&T) -> &R + Clone,

source§

type Guard = MapGuard<<A as Access<T>>::Guard, F, T, R>

source§

impl<T> Access<T> for dyn DynAccess<T> + '_

source§

type Guard = DynGuard<T>

source§

impl<T> Access<T> for dyn DynAccess<T> + Send + '_

source§

type Guard = DynGuard<T>

source§

impl<T> Access<T> for dyn DynAccess<T> + Sync + Send + '_

source§

type Guard = DynGuard<T>

source§

impl<T, A: Access<T> + ?Sized, P: Deref<Target = A>> Access<T> for P

source§

type Guard = <A as Access<T>>::Guard

source§

impl<T, D> Access<T> for AccessConvert<D>
where D: Deref, D::Target: DynAccess<T>,

source§

type Guard = DynGuard<T>

source§

impl<T, S: Strategy<Rc<T>>> Access<T> for ArcSwapAny<Rc<T>, S>

source§

type Guard = DirectDeref<Rc<T>, S>

source§

impl<T, S: Strategy<Arc<T>>> Access<T> for ArcSwapAny<Arc<T>, S>

source§

type Guard = DirectDeref<Arc<T>, S>

source§

impl<T: RefCnt, S: Strategy<T>> Access<T> for ArcSwapAny<T, S>

source§

type Guard = Guard<T, S>

source§

impl<T: Clone> Access<T> for Constant<T>

source§

type Guard = ConstantDeref<T>