summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lock.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lock.rs b/src/lock.rs
index 5a6315d..54a836d 100644
--- a/src/lock.rs
+++ b/src/lock.rs
@@ -6,12 +6,17 @@ pub struct Lock {
is_locked: AtomicBool,
}
+/// A key for a lock.
+///
+/// This key is needed in order to unlock a [`Lock`]. The [`Lock`] is
+/// automatically unlocked if this key is dropped.
#[derive(Debug)]
pub struct Key<'a> {
lock: &'a Lock,
}
impl<'a> Key<'a> {
+ /// Create a key to a lock.
const fn new(lock: &'a Lock) -> Self {
Self { lock }
}