diff --git a/src/lib.rs b/src/lib.rs index 0a417d2..8bacad0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -43,6 +43,7 @@ #![deny(missing_docs)] use core::cell::RefCell; +use core::ops::{Deref, DerefMut}; /// Makes locks work on N-tuples, locks the mutexes from left-to-right in the tuple. These are /// used to reduce rightward drift in code and to help make intentions clearer. @@ -203,6 +204,20 @@ impl From for Exclusive { } } +impl Deref for Exclusive { + type Target = T; + + fn deref(&self) -> &T { + &self.0 + } +} + +impl DerefMut for Exclusive { + fn deref_mut(&mut self) -> &mut T { + &mut self.0 + } +} + impl Mutex for Exclusive { type Data = T;