pub struct MappedRwLockWriteGuard<'rwlock, T: ?Sized + 'rwlock> { /* private fields */ }
mapped_lock_guards #117108)
RAII structure used to release the exclusive write access of a lock when dropped, which can point to a subfield of the protected data.
This structure is created by the map and filter_map methods on RwLockWriteGuard.
impl<'rwlock, T: ?Sized> MappedRwLockWriteGuard<'rwlock, T>
pub fn map<U, F>(orig: Self, f: F) -> MappedRwLockWriteGuard<'rwlock, U>where
F: FnOnce(&mut T) -> &mut U,
U: ?Sized,mapped_lock_guards #117108)
Makes a MappedRwLockWriteGuard for a component of the borrowed data, e.g. an enum variant.
The RwLock is already locked for writing, so this cannot fail.
This is an associated function that needs to be used as MappedRwLockWriteGuard::map(...). A method would interfere with methods of the same name on the contents of the MappedRwLockWriteGuard used through Deref.
If the closure panics, the guard will be dropped (unlocked).
pub fn filter_map<U, F>(
orig: Self,
f: F,
) -> Result<MappedRwLockWriteGuard<'rwlock, U>, Self>where
F: FnOnce(&mut T) -> Option<&mut U>,
U: ?Sized,mapped_lock_guards #117108)
Makes a MappedRwLockWriteGuard for a component of the borrowed data. The original guard is returned as an Err(...) if the closure returns None.
The RwLock is already locked for writing, so this cannot fail.
This is an associated function that needs to be used as MappedRwLockWriteGuard::filter_map(...). A method would interfere with methods of the same name on the contents of the MappedRwLockWriteGuard used through Deref.
If the closure panics, the guard will be dropped (unlocked).
impl<T: ?Sized + Debug> Debug for MappedRwLockWriteGuard<'_, T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<T: ?Sized> Deref for MappedRwLockWriteGuard<'_, T>
type Target = T
fn deref(&self) -> &T
impl<T: ?Sized> DerefMut for MappedRwLockWriteGuard<'_, T>
fn deref_mut(&mut self) -> &mut T
impl<T: ?Sized + Display> Display for MappedRwLockWriteGuard<'_, T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<T: ?Sized> Drop for MappedRwLockWriteGuard<'_, T>
impl<T: ?Sized> !Send for MappedRwLockWriteGuard<'_, T>
impl<T: ?Sized + Sync> Sync for MappedRwLockWriteGuard<'_, T>
impl<'rwlock, T> Freeze for MappedRwLockWriteGuard<'rwlock, T>where
T: ?Sized,impl<'rwlock, T> RefUnwindSafe for MappedRwLockWriteGuard<'rwlock, T>where
T: RefUnwindSafe + ?Sized,impl<'rwlock, T> Unpin for MappedRwLockWriteGuard<'rwlock, T>where
T: ?Sized,impl<'rwlock, T> !UnwindSafe for MappedRwLockWriteGuard<'rwlock, T>
impl<T> Any for Twhere
T: 'static + ?Sized,impl<T> Borrow<T> for Twhere
T: ?Sized,impl<T> BorrowMut<T> for Twhere
T: ?Sized,impl<T> From<T> for T
fn from(t: T) -> T
Returns the argument unchanged.
impl<T, U> Into<U> for Twhere
U: From<T>,fn into(self) -> U
Calls U::from(self).
That is, this conversion is whatever the implementation of From<T> for U chooses to do.
impl<P, T> Receiver for Pwhere
P: Deref<Target = T> + ?Sized,
T: ?Sized,type Target = T
arbitrary_self_types #44874)
impl<T> ToString for Twhere
T: Display + ?Sized,impl<T, U> TryFrom<U> for Twhere
U: Into<T>,type Error = Infallible
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Twhere
U: TryFrom<T>,
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/sync/nonpoison/struct.MappedRwLockWriteGuard.html