Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit f1ac15b

Browse files
Merge #6
6: Implement Deref{Mut} for Exclusive r=adamgreig a=jonas-schievink Quick fix before publishing 0.1 Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 parents 5b30914 + 16a0aff commit f1ac15b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/lib.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#![deny(missing_docs)]
4444

4545
use core::cell::RefCell;
46+
use core::ops::{Deref, DerefMut};
4647

4748
/// Makes locks work on N-tuples, locks the mutexes from left-to-right in the tuple. These are
4849
/// used to reduce rightward drift in code and to help make intentions clearer.
@@ -203,6 +204,20 @@ impl<T> From<T> for Exclusive<T> {
203204
}
204205
}
205206

207+
impl<T> Deref for Exclusive<T> {
208+
type Target = T;
209+
210+
fn deref(&self) -> &T {
211+
&self.0
212+
}
213+
}
214+
215+
impl<T> DerefMut for Exclusive<T> {
216+
fn deref_mut(&mut self) -> &mut T {
217+
&mut self.0
218+
}
219+
}
220+
206221
impl<T> Mutex for Exclusive<T> {
207222
type Data = T;
208223

0 commit comments

Comments
 (0)