pub trait DynAccess<T> {
    fn load(&self) -> DynGuard<T>;
}
Expand description

An object-safe version of the Access trait.

This can be used instead of the Access trait in case a type erasure is desired. This has the effect of performance hit (due to boxing of the result and due to dynamic dispatch), but makes certain code simpler and possibly makes the executable smaller.

This is automatically implemented for everything that implements Access.

Examples

use arc_swap::access::{Constant, DynAccess};

fn do_something(value: Box<dyn DynAccess<usize> + Send>) {
    let v = value.load();
    println!("{}", *v);
}

do_something(Box::new(Constant(42)));

Required Methods§

The equivalent of Access::load.

Trait Implementations§

A guard object containing the value and keeping it alive. Read more
The loading method. Read more
A guard object containing the value and keeping it alive. Read more
The loading method. Read more
A guard object containing the value and keeping it alive. Read more
The loading method. Read more

Implementors§