[][src]Trait arc_swap::access::DynAccess

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

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.


extern crate arc_swap;

use std::thread;

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

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


Required methods

fn load(&self) -> DynGuard<T>

The equivalent of Access::load.

Loading content...


impl<T, A> DynAccess<T> for A where
    A: Access<T>,
    A::Guard: 'static, 

Loading content...