summaryrefslogtreecommitdiff
path: root/src/rwlock.rs
diff options
context:
space:
mode:
authorMica White <botahamec@outlook.com>2024-03-11 22:41:13 -0400
committerMica White <botahamec@outlook.com>2024-03-11 22:41:13 -0400
commita22ffadbebddcbec9bb127b295f8a8516174e6e6 (patch)
tree66925b072f43646aafb40834e293c11b98f08c87 /src/rwlock.rs
parentef34f899313ed4e4c5e452aef2c670f7d51f1ca9 (diff)
More trait bound fixes
Diffstat (limited to 'src/rwlock.rs')
-rw-r--r--src/rwlock.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/rwlock.rs b/src/rwlock.rs
index f11b204..df68fc5 100644
--- a/src/rwlock.rs
+++ b/src/rwlock.rs
@@ -67,10 +67,16 @@ pub struct ReadLock<'a, T: ?Sized, R>(&'a RwLock<T, R>);
pub struct WriteLock<'a, T: ?Sized, R>(&'a RwLock<T, R>);
/// RAII structure that unlocks the shared read access to a [`RwLock`]
-pub struct RwLockReadRef<'a, T: ?Sized, R: RawRwLock>(&'a RwLock<T, R>);
+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`]
-pub struct RwLockWriteRef<'a, T: ?Sized, R: RawRwLock>(&'a RwLock<T, R>);
+pub struct RwLockWriteRef<'a, T: ?Sized, R: RawRwLock>(
+ &'a RwLock<T, R>,
+ PhantomData<(&'a mut T, R::GuardMarker)>,
+);
/// RAII structure used to release the shared read access of a lock when
/// dropped.
@@ -84,7 +90,6 @@ pub struct RwLockReadGuard<'a, 'key, T: ?Sized, Key: Keyable + 'key, R: RawRwLoc
rwlock: RwLockReadRef<'a, T, R>,
thread_key: Key,
_phantom1: PhantomData<&'key ()>,
- _phantom2: PhantomData<*const ()>,
}
/// RAII structure used to release the exclusive write access of a lock when
@@ -98,5 +103,4 @@ pub struct RwLockWriteGuard<'a, 'key, T: ?Sized, Key: Keyable + 'key, R: RawRwLo
rwlock: RwLockWriteRef<'a, T, R>,
thread_key: Key,
_phantom1: PhantomData<&'key ()>,
- _phantom2: PhantomData<*const ()>,
}