From 4fd5136e0c0ec9cc92bb2b5735c0b3b68acdd755 Mon Sep 17 00:00:00 2001 From: Botahamec Date: Wed, 25 Sep 2024 21:36:13 -0400 Subject: Update docs for ref guards --- src/mutex.rs | 10 +++++++--- src/rwlock.rs | 6 ++++++ 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 { data: UnsafeCell, } -/// 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, 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); pub struct WriteLock<'l, T: ?Sized, R>(&'l RwLock); /// 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, 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, PhantomData<(&'a mut T, R::GuardMarker)>, -- cgit v1.2.3