pub struct WriteGuard<'lock, T, U = T> { /* private fields */ }Expand description
A RAII guard that guarantees unique write access to a TryRwLock.
Implementations§
Source§impl<'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 maping 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§
Source§impl<T, U: Debug> Debug for WriteGuard<'_, T, U>
impl<T, U: Debug> Debug for WriteGuard<'_, T, U>
Source§impl<T, U> Deref for WriteGuard<'_, T, U>
impl<T, U> Deref for WriteGuard<'_, T, U>
Source§impl<T, U> DerefMut for WriteGuard<'_, T, U>
impl<T, U> DerefMut for WriteGuard<'_, T, U>
Source§impl<T, U: Display> Display for WriteGuard<'_, T, U>
impl<T, U: Display> Display for WriteGuard<'_, T, U>
Source§impl<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> Freeze for WriteGuard<'lock, T, U>
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more