Struct guardian::RcRwLockWriteGuardian [] [src]

pub struct RcRwLockWriteGuardian<T: 'static> {
    // some fields omitted
}

RAII structure used to release the exclusive write access of a lock when dropped. Keeps a handle to an Rc so that the lock is not dropped until the guard is.

The data protected by the mutex can be access through this guard via its Deref and DerefMut implementations.

Methods

impl<T> RcRwLockWriteGuardian<T>
[src]

fn take(handle: Rc<RwLock<T>>) -> LockResult<RcRwLockWriteGuardian<T>>

Locks this rwlock with exclusive write access, blocking the current thread until it can be acquired.

This function will not return while other writers or other readers currently have access to the lock.

Returns an RAII guard which will drop the write access of this rwlock when dropped. The guardian also holds a strong reference to the lock's Rc, which is dropped when the guard is.

Errors

This function will return an error if the RwLock is poisoned. An RwLock is poisoned whenever a writer panics while holding an exclusive lock. An error will be returned when the lock is acquired.

Trait Implementations

impl<T> Deref for RcRwLockWriteGuardian<T>
[src]

type Target = T

The resulting type after dereferencing

fn deref(&self) -> &Self::Target

The method called to dereference a value

impl<T> DerefMut for RcRwLockWriteGuardian<T>
[src]

fn deref_mut(&mut self) -> &mut T

The method called to mutably dereference a value

impl<T> From<Rc<RwLock<T>>> for RcRwLockWriteGuardian<T>
[src]

fn from(handle: Rc<RwLock<T>>) -> Self

Performs the conversion.