summaryrefslogtreecommitdiff
path: root/src/rwlock/rwlock.rs
diff options
context:
space:
mode:
authorMica White <botahamec@gmail.com>2024-12-25 17:58:06 -0500
committerMica White <botahamec@gmail.com>2024-12-25 17:58:06 -0500
commit37ab873d21ca1fcd43db8d6a26d5bac4f5285f71 (patch)
tree987e0a0604c29ceea8d17e424df65993608c7ea5 /src/rwlock/rwlock.rs
parentbfdbf20a813bb4b5527a3d6ff4a5c1bac134b466 (diff)
Move some logic into the Sharable trait
Diffstat (limited to 'src/rwlock/rwlock.rs')
-rw-r--r--src/rwlock/rwlock.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/rwlock/rwlock.rs b/src/rwlock/rwlock.rs
index b5dea75..2c9ba22 100644
--- a/src/rwlock/rwlock.rs
+++ b/src/rwlock/rwlock.rs
@@ -79,11 +79,6 @@ unsafe impl<T: Send, R: RawRwLock + Send + Sync> Lockable for RwLock<T, R> {
where
Self: 'g;
- type ReadGuard<'g>
- = RwLockReadRef<'g, T, R>
- where
- Self: 'g;
-
fn get_ptrs<'a>(&'a self, ptrs: &mut Vec<&'a dyn RawLock>) {
ptrs.push(self);
}
@@ -91,10 +86,6 @@ unsafe impl<T: Send, R: RawRwLock + Send + Sync> Lockable for RwLock<T, R> {
unsafe fn guard(&self) -> Self::Guard<'_> {
RwLockWriteRef::new(self)
}
-
- unsafe fn read_guard(&self) -> Self::ReadGuard<'_> {
- RwLockReadRef::new(self)
- }
}
impl<T: Send, R: RawRwLock + Send + Sync> LockableIntoInner for RwLock<T, R> {
@@ -116,7 +107,16 @@ impl<T: Send, R: RawRwLock + Send + Sync> LockableAsMut for RwLock<T, R> {
}
}
-unsafe impl<T: Send, R: RawRwLock + Send + Sync> Sharable for RwLock<T, R> {}
+unsafe impl<T: Send, R: RawRwLock + Send + Sync> Sharable for RwLock<T, R> {
+ type ReadGuard<'g>
+ = RwLockReadRef<'g, T, R>
+ where
+ Self: 'g;
+
+ unsafe fn read_guard(&self) -> Self::ReadGuard<'_> {
+ RwLockReadRef::new(self)
+ }
+}
unsafe impl<T: Send, R: RawRwLock + Send + Sync> OwnedLockable for RwLock<T, R> {}