Trait concurrency_traits::AsyncRwLock[][src]

pub trait AsyncRwLock<'a>: TryRwLock<'a> {
    type AsyncReadGuard: Deref<Target = Self::Item>;
    type AsyncWriteGuard: DerefMut<Target = Self::Item>;
    type ReadFuture: Future<Output = Self::AsyncReadGuard>;
    type WriteFuture: Future<Output = Self::AsyncWriteGuard>;
    fn read_async(&'a self) -> Self::ReadFuture;
fn write_async(&'a self) -> Self::WriteFuture; }

A generic async reader-writer lock trait

Implementation

It is recommended to implement AsyncRwLockSized if the implement-ee can be sized.

Associated Types

type AsyncReadGuard: Deref<Target = Self::Item>[src]

The read guard for async reading

type AsyncWriteGuard: DerefMut<Target = Self::Item>[src]

The write guard for async writing

type ReadFuture: Future<Output = Self::AsyncReadGuard>[src]

The future returned by read_async

type WriteFuture: Future<Output = Self::AsyncWriteGuard>[src]

The future returned by write_async

Loading content...

Required methods

fn read_async(&'a self) -> Self::ReadFuture[src]

Reads the lock asynchronously, giving a future that will contain the read lock

fn write_async(&'a self) -> Self::WriteFuture[src]

Writes to the lock asynchronously, giving a future that will contain the write lock

Loading content...

Implementors

impl<'a, T, R> AsyncRwLock<'a> for CustomRwLock<T, R> where
    T: 'a,
    R: RawAsyncRwLock + 'a, 
[src]

type AsyncReadGuard = CustomReadGuard<'a, T, R>

type AsyncWriteGuard = CustomWriteGuard<'a, T, R>

type ReadFuture = Pin<Box<dyn Future<Output = Self::AsyncReadGuard> + 'a>>

type WriteFuture = Pin<Box<dyn Future<Output = Self::AsyncWriteGuard> + 'a>>

impl<'a, T: ?Sized> AsyncRwLock<'a> for T where
    T: Deref,
    T::Target: AsyncRwLock<'a>, 
[src]

Loading content...