pub struct OwnedMappedMutexGuard<T: ?Sized, U: ?Sized = T> { /* private fields */ }
sync
only.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§
Source§impl<T: ?Sized, U: ?Sized> OwnedMappedMutexGuard<T, U>
impl<T: ?Sized, U: ?Sized> OwnedMappedMutexGuard<T, U>
Sourcepub fn map<S, F>(this: Self, f: F) -> OwnedMappedMutexGuard<T, S>
pub fn map<S, F>(this: Self, 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.
Sourcepub fn try_map<S, F>(
this: Self,
f: F,
) -> Result<OwnedMappedMutexGuard<T, S>, Self>
pub fn try_map<S, F>( this: Self, f: F, ) -> Result<OwnedMappedMutexGuard<T, S>, Self>
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.
Trait Implementations§
impl<T, U> Send for OwnedMappedMutexGuard<T, U>
impl<T, U> Sync for OwnedMappedMutexGuard<T, U>
Auto Trait Implementations§
impl<T, U> Freeze for OwnedMappedMutexGuard<T, U>
impl<T, U = T> !RefUnwindSafe for OwnedMappedMutexGuard<T, U>
impl<T, U> Unpin for OwnedMappedMutexGuard<T, U>
impl<T, U = T> !UnwindSafe for OwnedMappedMutexGuard<T, U>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.