[][src]Trait mutex_trait::Mutex

pub trait Mutex {
    type Data;
    fn lock<R>(&mut self, f: impl FnOnce(&mut Self::Data) -> R) -> R;
}

Any object implementing this trait guarantees exclusive access to the data contained within the mutex for the duration of the lock.

Associated Types

type Data

Data protected by the mutex.

Loading content...

Required methods

fn lock<R>(&mut self, f: impl FnOnce(&mut Self::Data) -> R) -> R

Creates a critical section and grants temporary access to the protected data.

Loading content...

Implementations on Foreign Types

impl<'_, T> Mutex for &'_ RefCell<T>[src]

type Data = T

Loading content...

Implementors

impl<'_, L> Mutex for &'_ mut L where
    L: Mutex
[src]

type Data = L::Data

impl<'a, T> Mutex for Exclusive<'a, T>[src]

type Data = T

Loading content...