pub struct RwLockWriteGuard<'a, T: ?Sized + 'a> { /* private fields */ }
Expand description
RAII structure used to release the exclusive write access of a lock when dropped.
Implementations§
Source§impl<'rwlock, T: ?Sized> RwLockWriteGuard<'rwlock, T>
impl<'rwlock, T: ?Sized> RwLockWriteGuard<'rwlock, T>
Sourcepub fn map<U: ?Sized, F>(this: Self, cb: F) -> RwLockWriteGuard<'rwlock, U>
pub fn map<U: ?Sized, F>(this: Self, cb: F) -> RwLockWriteGuard<'rwlock, U>
Transform this guard to hold a sub-borrow of the original data.
Applies the supplied closure to the data, returning a new lock guard referencing the borrow returned by the closure.
§Examples
let x = RwLock::new(vec![1, 2]);
{
let mut y = RwLockWriteGuard::map(x.write().unwrap(), |v| &mut v[0]);
assert_eq!(*y, 1);
*y = 10;
}
assert_eq!(&**x.read().unwrap(), &[10, 2]);
Sourcepub fn filter_map<U: ?Sized, E, F>(
this: Self,
cb: F,
) -> Result<RwLockWriteGuard<'rwlock, U>, (Self, E)>
pub fn filter_map<U: ?Sized, E, F>( this: Self, cb: F, ) -> Result<RwLockWriteGuard<'rwlock, U>, (Self, E)>
Conditionally get a new guard to a sub-borrow depending on the original contents of the guard.
Trait Implementations§
Source§impl<'rwlock, T: ?Sized> Deref for RwLockWriteGuard<'rwlock, T>
impl<'rwlock, T: ?Sized> Deref for RwLockWriteGuard<'rwlock, T>
Source§impl<'rwlock, T: ?Sized> DerefMut for RwLockWriteGuard<'rwlock, T>
impl<'rwlock, T: ?Sized> DerefMut for RwLockWriteGuard<'rwlock, T>
Auto Trait Implementations§
impl<'a, T> Freeze for RwLockWriteGuard<'a, T>where
T: ?Sized,
impl<'a, T> !RefUnwindSafe for RwLockWriteGuard<'a, T>
impl<'a, T> !Send for RwLockWriteGuard<'a, T>
impl<'a, T> !Sync for RwLockWriteGuard<'a, T>
impl<'a, T> Unpin for RwLockWriteGuard<'a, T>where
T: ?Sized,
impl<'a, T> !UnwindSafe for RwLockWriteGuard<'a, T>
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