Struct embassy_sync::mutex::MappedMutexGuard
source · pub struct MappedMutexGuard<'a, M, T>where
M: RawMutex,
T: ?Sized,{ /* private fields */ }
Expand description
A handle to a held Mutex
that has had a function applied to it via MutexGuard::map
or
MappedMutexGuard::map
.
This can be used to hold a subfield of the protected data.
Implementations§
source§impl<'a, M, T> MappedMutexGuard<'a, M, T>where
M: RawMutex,
T: ?Sized,
impl<'a, M, T> MappedMutexGuard<'a, M, T>where
M: RawMutex,
T: ?Sized,
sourcepub fn map<U>(
this: Self,
fun: impl FnOnce(&mut T) -> &mut U,
) -> MappedMutexGuard<'a, M, U>
pub fn map<U>( this: Self, fun: impl FnOnce(&mut T) -> &mut U, ) -> MappedMutexGuard<'a, M, U>
Returns a locked view over a portion of the locked data.