pub struct Mutex<T: ?Sized> {
data: UnsafeCell<Cell<T>>,
}
Expand description
Mutex
implements a guard that is safe for “concurrent” data access on single-core devices
that can only experience non-atomic data access via interrupts. It restricts data access to
within a CriticalSection
, which can only be obtained within a closure given to
without_interrupts
.
The data is wrapped in a core::cell::Cell
for mutability. For more complex data structures,
see the DynamicMutex
type which is based on a RefCell
.
Fields§
§data: UnsafeCell<Cell<T>>
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Mutex<T>
impl<T: ?Sized> Send for Mutex<T>where
T: Send,
impl<T: ?Sized> Unpin for Mutex<T>where
T: Unpin,
impl<T: ?Sized> UnwindSafe for Mutex<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more