Struct MappedRwLockWriteGuard

struct MappedRwLockWriteGuard<'rwlock, T: ?Sized + 'rwlock> { ... }

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.

Implementations

impl<'rwlock, T: ?Sized> MappedRwLockWriteGuard<'rwlock, T>

fn map<U, F>(orig: Self, f: F) -> MappedRwLockWriteGuard<'rwlock, U>
where
    F: FnOnce(&mut T) -> &mut U,
    U: ?Sized

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.

Panics

If the closure panics, the guard will be dropped (unlocked).

fn filter_map<U, F>(orig: Self, f: F) -> Result<MappedRwLockWriteGuard<'rwlock, U>, Self>
where
    F: FnOnce(&mut T) -> Option<&mut U>,
    U: ?Sized

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.

Panics

If the closure panics, the guard will be dropped (unlocked).

impl<'rwlock, T> Freeze for MappedRwLockWriteGuard<'rwlock, T>

impl<'rwlock, T> RefUnwindSafe for MappedRwLockWriteGuard<'rwlock, T>

impl<'rwlock, T> Unpin for MappedRwLockWriteGuard<'rwlock, T>

impl<'rwlock, T> UnsafeUnpin for MappedRwLockWriteGuard<'rwlock, T>

impl<'rwlock, T> UnwindSafe for MappedRwLockWriteGuard<'rwlock, T>

impl<P, T> Receiver for MappedRwLockWriteGuard<'rwlock, T>

impl<T> Any for MappedRwLockWriteGuard<'rwlock, T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for MappedRwLockWriteGuard<'rwlock, T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for MappedRwLockWriteGuard<'rwlock, T>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> From for MappedRwLockWriteGuard<'rwlock, T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToString for MappedRwLockWriteGuard<'rwlock, T>

fn to_string(self: &Self) -> String

impl<T, U> Into for MappedRwLockWriteGuard<'rwlock, T>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for MappedRwLockWriteGuard<'rwlock, T>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for MappedRwLockWriteGuard<'rwlock, T>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<T: ?Sized + Sync> Sync for MappedRwLockWriteGuard<'_, T>

impl<T: ?Sized + fmt::Debug> Debug for MappedRwLockWriteGuard<'_, T>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<T: ?Sized + fmt::Display> Display for MappedRwLockWriteGuard<'_, T>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<T: ?Sized> Deref for MappedRwLockWriteGuard<'_, T>

fn deref(self: &Self) -> &T

impl<T: ?Sized> DerefMut for MappedRwLockWriteGuard<'_, T>

fn deref_mut(self: &mut Self) -> &mut T

impl<T: ?Sized> Drop for MappedRwLockWriteGuard<'_, T>

fn drop(self: &mut Self)

impl<T: ?Sized> Send for MappedRwLockWriteGuard<'_, T>