Trait monster::incubation::with_lock::WithLock
[−]
[src]
pub trait WithLock<T> { fn with_lock<F: FnOnce(&mut T) -> R, R>(&self, f: F) -> R; }
Required Methods
fn with_lock<F: FnOnce(&mut T) -> R, R>(&self, f: F) -> R
Conveniently access mutexes.
Example
use std::sync::Mutex; use monster::incubation::WithLock; let n = Mutex::new(123); n.with_lock(|n| { *n += 654 });
Implementors
impl<T> WithLock<T> for Mutex<T>