Struct MappedMutexGuard

struct MappedMutexGuard<'a, T: ?Sized> { ... }

A handle to a held Mutex that has had a function applied to it via MutexGuard::map.

This can be used to hold a subfield of the protected data.

Implementations

impl<'a, T: ?Sized> MappedMutexGuard<'a, T>

fn map<U, F>(this: Self, f: F) -> MappedMutexGuard<'a, U>
where
    F: FnOnce(&mut T) -> &mut U

Makes a new MappedMutexGuard for a component of the locked data.

This operation cannot fail as the MappedMutexGuard passed in already locked the mutex.

This is an associated function that needs to be used as MappedMutexGuard::map(...). A method would interfere with methods of the same name on the contents of the locked data.

fn try_map<U, F>(this: Self, f: F) -> Result<MappedMutexGuard<'a, U>, Self>
where
    F: FnOnce(&mut T) -> Option<&mut U>

Attempts to make a new MappedMutexGuard for a component of the locked data. The original guard is returned if the closure returns None.

This operation cannot fail as the MappedMutexGuard passed in already locked the mutex.

This is an associated function that needs to be used as MappedMutexGuard::try_map(...). A method would interfere with methods of the same name on the contents of the locked data.

impl<'a, T> Freeze for MappedMutexGuard<'a, T>

impl<'a, T> RefUnwindSafe for MappedMutexGuard<'a, T>

impl<'a, T> Send for MappedMutexGuard<'a, T>

impl<'a, T> Sync for MappedMutexGuard<'a, T>

impl<'a, T> Unpin for MappedMutexGuard<'a, T>

impl<'a, T> UnsafeUnpin for MappedMutexGuard<'a, T>

impl<'a, T> UnwindSafe for MappedMutexGuard<'a, T>

impl<'a, T: ?Sized + fmt::Debug> Debug for MappedMutexGuard<'a, T>

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

impl<'a, T: ?Sized + fmt::Display> Display for MappedMutexGuard<'a, T>

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

impl<'a, T: ?Sized> Deref for MappedMutexGuard<'a, T>

fn deref(self: &Self) -> &<Self as >::Target

impl<'a, T: ?Sized> DerefMut for MappedMutexGuard<'a, T>

fn deref_mut(self: &mut Self) -> &mut <Self as >::Target

impl<'a, T: ?Sized> Drop for MappedMutexGuard<'a, T>

fn drop(self: &mut Self)

impl<P, T> Receiver for MappedMutexGuard<'a, T>

impl<T> Any for MappedMutexGuard<'a, T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for MappedMutexGuard<'a, T>

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

impl<T> BorrowMut for MappedMutexGuard<'a, T>

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

impl<T> From for MappedMutexGuard<'a, T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToString for MappedMutexGuard<'a, T>

fn to_string(self: &Self) -> String

impl<T, U> Into for MappedMutexGuard<'a, 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 MappedMutexGuard<'a, T>

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

impl<T, U> TryInto for MappedMutexGuard<'a, T>

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