summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBotahamec <botahamec@outlook.com>2024-09-25 21:36:13 -0400
committerBotahamec <botahamec@outlook.com>2024-09-25 21:36:13 -0400
commit4fd5136e0c0ec9cc92bb2b5735c0b3b68acdd755 (patch)
tree017bc3fd0e15ebb609383804b01651ee78bc4a3b /src
parent7443474f1f00d2a9306079641dbb3c18df5e6445 (diff)
Update docs for ref guards
Diffstat (limited to 'src')
-rw-r--r--src/mutex.rs10
-rw-r--r--src/rwlock.rs6
2 files changed, 13 insertions, 3 deletions
diff --git a/src/mutex.rs b/src/mutex.rs
index b30c2b1..433ab47 100644
--- a/src/mutex.rs
+++ b/src/mutex.rs
@@ -36,14 +36,18 @@ pub struct Mutex<T: ?Sized, R> {
data: UnsafeCell<T>,
}
-/// A reference to a mutex that unlocks it when dropped
+/// A reference to a mutex that unlocks it when dropped.
+///
+/// This is similar to [`MutexGuard`], except it does not hold a [`Keyable`].
pub struct MutexRef<'a, T: ?Sized + 'a, R: RawMutex>(
&'a Mutex<T, R>,
PhantomData<(&'a mut T, R::GuardMarker)>,
);
-/// An RAII implementation of a “scoped lock” of a mutex. When this structure
-/// is dropped (falls out of scope), the lock will be unlocked.
+/// An RAII implementation of a “scoped lock” of a mutex.
+///
+/// When this structure is dropped (falls out of scope), the lock will be
+/// unlocked.
///
/// This is created by calling the [`lock`] and [`try_lock`] methods on [`Mutex`]
///
diff --git a/src/rwlock.rs b/src/rwlock.rs
index 8f1ba8f..5715f89 100644
--- a/src/rwlock.rs
+++ b/src/rwlock.rs
@@ -69,12 +69,18 @@ pub struct ReadLock<'l, T: ?Sized, R>(&'l RwLock<T, R>);
pub struct WriteLock<'l, T: ?Sized, R>(&'l RwLock<T, R>);
/// RAII structure that unlocks the shared read access to a [`RwLock`]
+///
+/// This is similar to [`RwLockReadRef`], except it does not hold a
+/// [`Keyable`].
pub struct RwLockReadRef<'a, T: ?Sized, R: RawRwLock>(
&'a RwLock<T, R>,
PhantomData<(&'a mut T, R::GuardMarker)>,
);
/// RAII structure that unlocks the exclusive write access to a [`RwLock`]
+///
+/// This is similar to [`RwLockWriteRef`], except it does not hold a
+/// [`Keyable`].
pub struct RwLockWriteRef<'a, T: ?Sized, R: RawRwLock>(
&'a RwLock<T, R>,
PhantomData<(&'a mut T, R::GuardMarker)>,