pub struct OwnedMappedMutexGuard<T, U = T>{ /* private fields */ }
Expand description
A owned handle to a held Mutex
that has had a function applied to it via
OwnedMutexGuard::map
.
This can be used to hold a subfield of the protected data.
Implementations§
§impl<T, U> OwnedMappedMutexGuard<T, U>
impl<T, U> OwnedMappedMutexGuard<T, U>
pub fn map<S, F>(
this: OwnedMappedMutexGuard<T, U>,
f: F
) -> OwnedMappedMutexGuard<T, S>
pub fn map<S, F>( this: OwnedMappedMutexGuard<T, U>, f: F ) -> OwnedMappedMutexGuard<T, S>
Makes a new OwnedMappedMutexGuard
for a component of the locked data.
This operation cannot fail as the OwnedMappedMutexGuard
passed in already locked the mutex.
This is an associated function that needs to be used as OwnedMappedMutexGuard::map(...)
. A method
would interfere with methods of the same name on the contents of the locked data.
pub fn try_map<S, F>(
this: OwnedMappedMutexGuard<T, U>,
f: F
) -> Result<OwnedMappedMutexGuard<T, S>, OwnedMappedMutexGuard<T, U>>
pub fn try_map<S, F>( this: OwnedMappedMutexGuard<T, U>, f: F ) -> Result<OwnedMappedMutexGuard<T, S>, OwnedMappedMutexGuard<T, U>>
Attempts to make a new OwnedMappedMutexGuard
for a component of the locked data. The
original guard is returned if the closure returns None
.
This operation cannot fail as the OwnedMutexGuard
passed in already locked the mutex.
This is an associated function that needs to be used as OwnedMutexGuard::try_map(...)
. A
method would interfere with methods of the same name on the contents of the locked data.