diff options
| author | Mica White <botahamec@gmail.com> | 2024-12-25 17:58:06 -0500 |
|---|---|---|
| committer | Mica White <botahamec@gmail.com> | 2024-12-25 17:58:06 -0500 |
| commit | 37ab873d21ca1fcd43db8d6a26d5bac4f5285f71 (patch) | |
| tree | 987e0a0604c29ceea8d17e424df65993608c7ea5 /src/collection/ref.rs | |
| parent | bfdbf20a813bb4b5527a3d6ff4a5c1bac134b466 (diff) | |
Move some logic into the Sharable trait
Diffstat (limited to 'src/collection/ref.rs')
| -rw-r--r-- | src/collection/ref.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/collection/ref.rs b/src/collection/ref.rs index 9e07860..a9fc915 100644 --- a/src/collection/ref.rs +++ b/src/collection/ref.rs @@ -86,11 +86,6 @@ unsafe impl<L: Lockable> Lockable for RefLockCollection<'_, L> { where Self: 'g; - type ReadGuard<'g> - = L::ReadGuard<'g> - where - Self: 'g; - fn get_ptrs<'a>(&'a self, ptrs: &mut Vec<&'a dyn RawLock>) { ptrs.extend_from_slice(&self.locks); } @@ -98,14 +93,19 @@ unsafe impl<L: Lockable> Lockable for RefLockCollection<'_, L> { unsafe fn guard(&self) -> Self::Guard<'_> { self.data.guard() } +} + +unsafe impl<L: Sharable> Sharable for RefLockCollection<'_, L> { + type ReadGuard<'g> + = L::ReadGuard<'g> + where + Self: 'g; unsafe fn read_guard(&self) -> Self::ReadGuard<'_> { self.data.read_guard() } } -unsafe impl<L: Sharable> Sharable for RefLockCollection<'_, L> {} - impl<L: Debug> Debug for RefLockCollection<'_, L> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct(stringify!(RefLockCollection)) |
