Struct try_rwlock::WriteGuard
source · [−]pub struct WriteGuard<'lock, T, U = T> { /* private fields */ }
Expand description
A RAII guard that guarantees unique write access to a TryRwLock
.
Implementations
sourceimpl<'lock, T, U> WriteGuard<'lock, T, U>
impl<'lock, T, U> WriteGuard<'lock, T, U>
sourcepub fn rwlock(guard: &Self) -> &'lock TryRwLock<T>
pub fn rwlock(guard: &Self) -> &'lock TryRwLock<T>
Get a shared reference to the lock that this write guard has locked.
sourcepub fn downgrade(guard: Self) -> ReadGuard<'lock, T>
pub fn downgrade(guard: Self) -> ReadGuard<'lock, T>
Downgrade the WriteGuard
to a ReadGuard
.
Note that for soundness reasons, this will undo any map
ing that has
previously been applied.
sourcepub fn map<V>(
guard: Self,
f: impl FnOnce(&mut U) -> &mut V
) -> WriteGuard<'lock, T, V>
pub fn map<V>(
guard: Self,
f: impl FnOnce(&mut U) -> &mut V
) -> WriteGuard<'lock, T, V>
Map to another value and keep locked.
sourcepub fn unmap(guard: Self) -> WriteGuard<'lock, T>
pub fn unmap(guard: Self) -> WriteGuard<'lock, T>
Undo any previous mapping applied, returning the guard back to its original state.
Trait Implementations
sourceimpl<T, U: Debug> Debug for WriteGuard<'_, T, U>
impl<T, U: Debug> Debug for WriteGuard<'_, T, U>
sourceimpl<T, U> Deref for WriteGuard<'_, T, U>
impl<T, U> Deref for WriteGuard<'_, T, U>
sourceimpl<T, U> DerefMut for WriteGuard<'_, T, U>
impl<T, U> DerefMut for WriteGuard<'_, T, U>
sourceimpl<T, U: Display> Display for WriteGuard<'_, T, U>
impl<T, U: Display> Display for WriteGuard<'_, T, U>
sourceimpl<T, U> Drop for WriteGuard<'_, T, U>
impl<T, U> Drop for WriteGuard<'_, T, U>
impl<T, U: Send> Send for WriteGuard<'_, T, U>
impl<T, U: Sync> Sync for WriteGuard<'_, T, U>
Auto Trait Implementations
impl<'lock, T, U = T> !RefUnwindSafe for WriteGuard<'lock, T, U>
impl<'lock, T, U> Unpin for WriteGuard<'lock, T, U>
impl<'lock, T, U = T> !UnwindSafe for WriteGuard<'lock, T, U>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more