pub struct MutexGuard<'a, T: ?Sized + 'a> { /* private fields */ }Expand description
Mutex types and guards for mutual exclusion.
RAII guard returned by Mutex::lock().
When this guard goes out of scope, the mutex is automatically unlocked.
Provides access to the protected data through Deref and DerefMut.
§Examples
ⓘ
use osal_rs::os::{Mutex, MutexFn};
let mutex = Mutex::new(0);
{
let mut guard = mutex.lock().unwrap();
*guard += 1; // Access protected data
} // Mutex automatically unlocked hereTrait Implementations§
Source§impl<'a, T: ?Sized> Deref for MutexGuard<'a, T>
Provides immutable access to the protected data.
impl<'a, T: ?Sized> Deref for MutexGuard<'a, T>
Provides immutable access to the protected data.
Source§impl<'a, T: ?Sized> DerefMut for MutexGuard<'a, T>
Provides mutable access to the protected data.
impl<'a, T: ?Sized> DerefMut for MutexGuard<'a, T>
Provides mutable access to the protected data.
Source§impl<'a, T: ?Sized> Drop for MutexGuard<'a, T>
Automatically unlocks the mutex when the guard goes out of scope.
impl<'a, T: ?Sized> Drop for MutexGuard<'a, T>
Automatically unlocks the mutex when the guard goes out of scope.
Source§impl<'a, T: ?Sized> MutexGuard<'a, T> for MutexGuard<'a, T>
impl<'a, T: ?Sized> MutexGuard<'a, T> for MutexGuard<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for MutexGuard<'a, T>where
T: ?Sized,
impl<'a, T> !RefUnwindSafe for MutexGuard<'a, T>
impl<'a, T> Send for MutexGuard<'a, T>
impl<'a, T> Sync for MutexGuard<'a, T>
impl<'a, T> Unpin for MutexGuard<'a, T>where
T: ?Sized,
impl<'a, T> UnsafeUnpin for MutexGuard<'a, T>where
T: ?Sized,
impl<'a, T> !UnwindSafe for MutexGuard<'a, T>
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
Mutably borrows from an owned value. Read more