Trait concurrency_traits::rw_lock::TryRwLockSized[][src]

pub trait TryRwLockSized<'a>: Sized + TryRwLock<'a> {
    fn try_read_func<O>(
        &'a self,
        func: impl FnOnce(Option<&Self::Item>) -> O
    ) -> O { ... }
fn try_write_func<O>(
        &'a self,
        func: impl FnOnce(Option<&mut Self::Item>) -> O
    ) -> O { ... } }
Expand description

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

Provided methods

fn try_read_func<O>(&'a self, func: impl FnOnce(Option<&Self::Item>) -> O) -> O[src]

Tries to read from the lock and runs func on the result

Implementation

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

fn try_write_func<O>(
    &'a self,
    func: impl FnOnce(Option<&mut Self::Item>) -> O
) -> O
[src]

Tries to write to the lock and runs func on the result

Implementation

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

Implementations on Foreign Types

impl<'a, T> TryRwLockSized<'a> for RwLock<T> where
    T: 'a, 
[src]

Implementors

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

fn try_read_func<O>(&'a self, func: impl FnOnce(Option<&Self::Item>) -> O) -> O[src]

fn try_write_func<O>(
    &'a self,
    func: impl FnOnce(Option<&mut Self::Item>) -> O
) -> O
[src]