pub struct OwnedRwLockWriteGuard<T: ?Sized> { /* private fields */ }Expand description
Exclusive access to a RwLock’s value through an Arc the guard
holds; releases on drop. Made by RwLock::write_owned. The release
makes the progress RwLockReadGuard’s does.
Implementations§
Source§impl<T: ?Sized> OwnedRwLockWriteGuard<T>
impl<T: ?Sized> OwnedRwLockWriteGuard<T>
Sourcepub fn map<F, U>(this: Self, f: F) -> OwnedRwLockMappedWriteGuard<T, U>
pub fn map<F, U>(this: Self, f: F) -> OwnedRwLockMappedWriteGuard<T, U>
A guard for a component of the locked data. It cannot fail: this guard already holds the write.
An associated function, OwnedRwLockWriteGuard::map(guard, f): a
method would shadow methods of the locked data.
Sourcepub fn downgrade_map<F, U>(this: Self, f: F) -> OwnedRwLockReadGuard<T, U>
pub fn downgrade_map<F, U>(this: Self, f: F) -> OwnedRwLockReadGuard<T, U>
A read guard for a component of the locked data, made while the
write is turned into a read in one step, as
downgrade does. Inside f the write is still
held, yet f is given only a &T: a &mut T could be kept past the
downgrade through interior mutability.
Sourcepub fn try_map<F, U>(
this: Self,
f: F,
) -> Result<OwnedRwLockMappedWriteGuard<T, U>, Self>
pub fn try_map<F, U>( this: Self, f: F, ) -> Result<OwnedRwLockMappedWriteGuard<T, U>, Self>
map that gives the guard back when f finds no
component, with the write still held.
Sourcepub fn try_downgrade_map<F, U>(
this: Self,
f: F,
) -> Result<OwnedRwLockReadGuard<T, U>, Self>
pub fn try_downgrade_map<F, U>( this: Self, f: F, ) -> Result<OwnedRwLockReadGuard<T, U>, Self>
downgrade_map that gives the guard back when
f finds no component: the lock is then neither released nor
downgraded.
Sourcepub fn into_mapped(this: Self) -> OwnedRwLockMappedWriteGuard<T>
pub fn into_mapped(this: Self) -> OwnedRwLockMappedWriteGuard<T>
This guard as an OwnedRwLockMappedWriteGuard, for a struct field
that holds one. The same as OwnedRwLockWriteGuard::map(guard, |me| me).
Sourcepub fn downgrade(self) -> OwnedRwLockReadGuard<T>
pub fn downgrade(self) -> OwnedRwLockReadGuard<T>
Turns the write into a read in one step, so no writer gets in
between. See RwLockWriteGuard::downgrade.