Trait concurrency_traits::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>; }
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]
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]
T: 'a,
fn try_write(&'a self) -> Option<Self::WriteGuard> where
T: 'a,
[src]
T: 'a,
impl<'__a, 'a, T: ?Sized> TryRwLock<'__a> for &'a T where
T: TryRwLock<'__a>,
[src]
impl<'__a, 'a, T: ?Sized> TryRwLock<'__a> for &'a T where
T: TryRwLock<'__a>,
[src]type Item = T::Item
type ReadGuard = T::ReadGuard
type WriteGuard = T::WriteGuard
fn try_read(&'__a self) -> Option<Self::ReadGuard>
[src]
fn try_write(&'__a self) -> Option<Self::WriteGuard>
[src]
impl<'__a, 'a, T: ?Sized> TryRwLock<'__a> for &'a mut T where
T: TryRwLock<'__a>,
[src]
impl<'__a, 'a, T: ?Sized> TryRwLock<'__a> for &'a mut T where
T: TryRwLock<'__a>,
[src]type Item = T::Item
type ReadGuard = T::ReadGuard
type WriteGuard = T::WriteGuard
fn try_read(&'__a self) -> Option<Self::ReadGuard>
[src]
fn try_write(&'__a self) -> Option<Self::WriteGuard>
[src]
impl<'__a, T: ?Sized> TryRwLock<'__a> for ManuallyDrop<T> where
T: TryRwLock<'__a>,
[src]
impl<'__a, T: ?Sized> TryRwLock<'__a> for ManuallyDrop<T> where
T: TryRwLock<'__a>,
[src]type Item = T::Item
type ReadGuard = T::ReadGuard
type WriteGuard = T::WriteGuard
fn try_read(&'__a self) -> Option<Self::ReadGuard>
[src]
fn try_write(&'__a self) -> Option<Self::WriteGuard>
[src]
impl<'__a, T> TryRwLock<'__a> for AssertUnwindSafe<T> where
T: TryRwLock<'__a>,
[src]
impl<'__a, T> TryRwLock<'__a> for AssertUnwindSafe<T> where
T: TryRwLock<'__a>,
[src]type Item = T::Item
type ReadGuard = T::ReadGuard
type WriteGuard = T::WriteGuard
fn try_read(&'__a self) -> Option<Self::ReadGuard>
[src]
fn try_write(&'__a self) -> Option<Self::WriteGuard>
[src]
impl<'__a, T: ?Sized> TryRwLock<'__a> for Rc<T> where
T: TryRwLock<'__a>,
[src]
impl<'__a, T: ?Sized> TryRwLock<'__a> for Rc<T> where
T: TryRwLock<'__a>,
[src]type Item = T::Item
type ReadGuard = T::ReadGuard
type WriteGuard = T::WriteGuard
fn try_read(&'__a self) -> Option<Self::ReadGuard>
[src]
fn try_write(&'__a self) -> Option<Self::WriteGuard>
[src]
impl<'__a, T: ?Sized> TryRwLock<'__a> for Arc<T> where
T: TryRwLock<'__a>,
[src]
impl<'__a, T: ?Sized> TryRwLock<'__a> for Arc<T> where
T: TryRwLock<'__a>,
[src]type Item = T::Item
type ReadGuard = T::ReadGuard
type WriteGuard = T::WriteGuard
fn try_read(&'__a self) -> Option<Self::ReadGuard>
[src]
fn try_write(&'__a self) -> Option<Self::WriteGuard>
[src]
impl<'__a, T: ?Sized> TryRwLock<'__a> for Box<T> where
T: TryRwLock<'__a>,
[src]
impl<'__a, T: ?Sized> TryRwLock<'__a> for Box<T> where
T: TryRwLock<'__a>,
[src]type Item = T::Item
type ReadGuard = T::ReadGuard
type WriteGuard = T::WriteGuard
fn try_read(&'__a self) -> Option<Self::ReadGuard>
[src]
fn try_write(&'__a self) -> Option<Self::WriteGuard>
[src]
impl<'__a, 'a, T> TryRwLock<'__a> for Cow<'a, T> where
T: TryRwLock<'__a> + Clone,
[src]
impl<'__a, 'a, T> TryRwLock<'__a> for Cow<'a, T> where
T: TryRwLock<'__a> + Clone,
[src]type Item = T::Item
type ReadGuard = T::ReadGuard
type WriteGuard = T::WriteGuard
fn try_read(&'__a self) -> Option<Self::ReadGuard>
[src]
fn try_write(&'__a self) -> Option<Self::WriteGuard>
[src]
Implementors
impl<'a, T, R> TryRwLock<'a> for CustomRwLock<T, R> where
T: 'a,
R: RawTryRwLock + 'a,
[src]
impl<'a, T, R> TryRwLock<'a> for CustomRwLock<T, R> where
T: 'a,
R: RawTryRwLock + 'a,
[src]