summaryrefslogtreecommitdiff
path: root/src/lock.rs
diff options
context:
space:
mode:
authorBotahamec <botahamec@outlook.com>2022-10-27 18:45:49 -0400
committerBotahamec <botahamec@outlook.com>2022-10-27 18:45:49 -0400
commit10b6575f982ea229663097bfa950a778f6809099 (patch)
tree20340289a8fb53d70c71d3eda58df63bd75b176d /src/lock.rs
parent462c15bf6838c50400b755554a236ee1c687fb22 (diff)
Documentation for `Key`
Diffstat (limited to 'src/lock.rs')
-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 }
}