pub trait Mutex {
    type Data;
    type Guard<'a>: Deref<Target = Self::Data> + DerefMut<Target = Self::Data>
    where
        Self::Data: 'a,
        Self: 'a
; fn new(data: Self::Data) -> Self;
fn lock(&self) -> Self::Guard<'_>; }
Expand description

A “std-like” Mutex trait for no_std environments.

Unlike mutex-trait this one does NOT take &mut self in its locking method.

This makes it compatible with core::sync::Arc, i.e. it can be passed around to threads freely.

Note that it uses Rust GATs, which requires nightly, but the hope is that GATs will be stabilized soon.

Associated Types

Data protected by the mutex.

Required methods

Implementations on Foreign Types

Implementors