Struct std::sync::MutexGuard
pub struct MutexGuard<'a, T: ?Sized + 'a> { /* fields omitted */ }
An RAII implementation of a “scoped lock” of a mutex. When this structure is dropped (falls out of scope), the lock will be unlocked.
The data protected by the mutex can be accessed through this guard via its Deref
and DerefMut
implementations.
This structure is created by the lock
and try_lock
methods on Mutex
.
Trait Implementations
impl<T: ?Sized + Debug> Debug for MutexGuard<'_, T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Formats the value using the given formatter. Read more
impl<T: ?Sized> Deref for MutexGuard<'_, T>
type Target = T
The resulting type after dereferencing.
fn deref(&self) -> &T
Dereferences the value.
impl<T: ?Sized> DerefMut for MutexGuard<'_, T>
fn deref_mut(&mut self) -> &mut T
Mutably dereferences the value.
impl<T: ?Sized + Display> Display for MutexGuard<'_, T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Formats the value using the given formatter. Read more
impl<T: ?Sized> Drop for MutexGuard<'_, T>
impl<T: ?Sized> !Send for MutexGuard<'_, T>
impl<T: ?Sized + Sync> Sync for MutexGuard<'_, T>
Auto Trait Implementations
impl<'a, T: ?Sized> RefUnwindSafe for MutexGuard<'a, T>
impl<'a, T: ?Sized> Unpin for MutexGuard<'a, T>
impl<'a, T: ?Sized> UnwindSafe for MutexGuard<'a, T>
Blanket Implementations
impl<T> From<T> for T
pub fn from(t: T) -> T
Performs the conversion.
pub fn into(self) -> U
Performs the conversion.
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/sync/struct.MutexGuard.html