AsyncAccess

Trait AsyncAccess 

Source
pub trait AsyncAccess<T> {
    // Required methods
    fn read_async<'a>(
        &'a self,
    ) -> impl Future<Output = AsyncReadGuard<'a, T>> + Send
       where T: 'a;
    fn write_async<'a>(
        &'a self,
    ) -> impl Future<Output = AsyncWriteGuard<'a, T>> + Send
       where T: 'a;
    fn get_cloned_async(&self) -> impl Future<Output = T> + Send
       where T: Clone;
}
Available on crate feature async only.
Expand description

Trait for asynchronous access to shared containers.

Required Methods§

Source

fn read_async<'a>( &'a self, ) -> impl Future<Output = AsyncReadGuard<'a, T>> + Send
where T: 'a,

Asynchronously acquires a read lock on the container.

Source

fn write_async<'a>( &'a self, ) -> impl Future<Output = AsyncWriteGuard<'a, T>> + Send
where T: 'a,

Asynchronously acquires a write lock on the container.

Source

fn get_cloned_async(&self) -> impl Future<Output = T> + Send
where T: Clone,

Asynchronously gets a clone of the contained value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§