Trait concurrency_traits::rw_lock::TryRwLock[][src]

pub trait TryRwLock<'a> {
    type Item: ?Sized;
    type ReadGuard: Deref<Target = Self::Item>;
    type WriteGuard: DerefMut<Target = Self::Item>;
    fn try_read(&'a self) -> Option<Self::ReadGuard>;
fn try_write(&'a self) -> Option<Self::WriteGuard>; }
Expand description

A non-blocking rwlock with try functions

Implementation

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

Associated Types

type Item: ?Sized[src]

The item stored by this lock

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

The guard for reading from this lock

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

The guard for writing to this lock

Required methods

fn try_read(&'a self) -> Option<Self::ReadGuard>[src]

Tries to read from the lock, returning None if cannot immediately

fn try_write(&'a self) -> Option<Self::WriteGuard>[src]

Tries to write to the lock, returning None if not able to immediately

Implementations on Foreign Types

impl<'a, T: ?Sized> TryRwLock<'a> for RwLock<T> where
    T: 'a, 
[src]

type Item = T

type ReadGuard = RwLockReadGuard<'a, T>

type WriteGuard = RwLockWriteGuard<'a, T>

fn try_read(&'a self) -> Option<Self::ReadGuard> where
    T: 'a, 
[src]

fn try_write(&'a self) -> Option<Self::WriteGuard> where
    T: 'a, 
[src]

Implementors

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

type Item = T

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

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

fn try_read(&'a self) -> Option<Self::ReadGuard>[src]

fn try_write(&'a self) -> Option<Self::WriteGuard>[src]