Trait concurrency_traits::AsyncRwLockSized[][src]

pub trait AsyncRwLockSized<'a>: Sized + AsyncRwLock<'a> + TryRwLockSized<'a> {
    fn read_async_func<F>(
        &'a self,
        func: impl FnOnce(&Self::Item) -> F + 'a
    ) -> Pin<Box<dyn Future<Output = F::Output> + 'a>>
    where
        F: Future
, { ... }
fn write_async_func<F>(
        &'a self,
        func: impl FnOnce(&mut Self::Item) -> F + 'a
    ) -> Pin<Box<dyn Future<Output = F::Output> + 'a>>
    where
        F: Future
, { ... } }

The functions for AsyncRwLock that only work for sized types. Separated to allow AsyncRwLock to be a trait object.

Provided methods

fn read_async_func<F>(
    &'a self,
    func: impl FnOnce(&Self::Item) -> F + 'a
) -> Pin<Box<dyn Future<Output = F::Output> + 'a>> where
    F: Future
[src]

Reads from the lock and runs func on the result asynchronously

Implementation

Should be overwritten by implementors if can be more optimal than creating a guard

fn write_async_func<F>(
    &'a self,
    func: impl FnOnce(&mut Self::Item) -> F + 'a
) -> Pin<Box<dyn Future<Output = F::Output> + 'a>> where
    F: Future
[src]

Writes to the lock and runs func on the result asynchronously

Implementation

Should be overwritten by implementors if can be more optimal than creating a guard

Loading content...

Implementors

impl<'a, T> AsyncRwLockSized<'a> for T where
    T: Deref,
    T::Target: AsyncRwLockSized<'a>, 
[src]

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

Loading content...