Struct OwnedMappedMutexGuard
#[must_use = "if unused the Mutex will immediately unlock"]
pub struct OwnedMappedMutexGuard<T: ?Sized, U: ?Sized = T> { /* private fields */ }
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: ?Sized, U: ?Sized> OwnedMappedMutexGuard<T, U>
fn map<S, F>(this: Self, f: F) -> OwnedMappedMutexGuard<T, S> where F: FnOnce(&mut U) -> &mut S,Makes a new
OwnedMappedMutexGuardfor a component of the locked data.This operation cannot fail as the
OwnedMappedMutexGuardpassed 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.fn try_map<S, F>(this: Self, f: F) -> Result<OwnedMappedMutexGuard<T, S>, Self> where F: FnOnce(&mut U) -> Option<&mut S>,Attempts to make a new
OwnedMappedMutexGuardfor a component of the locked data. The original guard is returned if the closure returnsNone.This operation cannot fail as the
OwnedMutexGuardpassed 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>
where
T: ?Sized + Send,
U: ?Sized + Send,
impl<T, U> Sync for OwnedMappedMutexGuard<T, U>
where
T: ?Sized + Send + Sync,
U: ?Sized + Send + Sync,
impl<T: ?Sized, U: ?Sized + Debug> Debug for OwnedMappedMutexGuard<T, U>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<T: ?Sized, U: ?Sized + Display> Display for OwnedMappedMutexGuard<T, U>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<T: ?Sized, U: ?Sized> Deref for OwnedMappedMutexGuard<T, U>
type Target = U;fn deref(&self) -> &Self::Target
impl<T: ?Sized, U: ?Sized> DerefMut for OwnedMappedMutexGuard<T, U>
fn deref_mut(&mut self) -> &mut Self::Target
impl<T: ?Sized, U: ?Sized> Drop for OwnedMappedMutexGuard<T, U>
fn drop(&mut self)
Auto Trait Implementations
impl<T, U = T> !RefUnwindSafe for OwnedMappedMutexGuard<T, U>
impl<T, U = T> !UnwindSafe for OwnedMappedMutexGuard<T, U>
impl<T, U> Freeze for OwnedMappedMutexGuard<T, U>
where
*mut U: Freeze,
Arc<Mutex<T>>: Freeze,
T: ?Sized,
U: ?Sized,
impl<T, U> Unpin for OwnedMappedMutexGuard<T, U>
where
*mut U: Unpin,
Arc<Mutex<T>>: Unpin,
T: ?Sized,
U: ?Sized,
impl<T, U> UnsafeUnpin for OwnedMappedMutexGuard<T, U>
where
*mut U: UnsafeUnpin,
Arc<Mutex<T>>: UnsafeUnpin,
T: ?Sized,
U: ?Sized,
Blanket Implementations
impl<P, T> Receiver for OwnedMappedMutexGuard<T, U>
where
P: Deref<Target = T> + ?Sized,
T: ?Sized,
type Target = T;
impl<T> Any for OwnedMappedMutexGuard<T, U>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for OwnedMappedMutexGuard<T, U>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for OwnedMappedMutexGuard<T, U>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for OwnedMappedMutexGuard<T, U>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToString for OwnedMappedMutexGuard<T, U>
where
T: Display + ?Sized,
fn to_string(&self) -> String
impl<T, U> Into<U> for OwnedMappedMutexGuard<T, U>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for OwnedMappedMutexGuard<T, U>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for OwnedMappedMutexGuard<T, U>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>