diff options
Diffstat (limited to 'src/collection')
| -rw-r--r-- | src/collection/boxed.rs | 14 | ||||
| -rw-r--r-- | src/collection/owned.rs | 20 | ||||
| -rw-r--r-- | src/collection/ref.rs | 14 | ||||
| -rw-r--r-- | src/collection/retry.rs | 20 |
4 files changed, 34 insertions, 34 deletions
diff --git a/src/collection/boxed.rs b/src/collection/boxed.rs index 6db0683..3766bed 100644 --- a/src/collection/boxed.rs +++ b/src/collection/boxed.rs @@ -62,11 +62,6 @@ unsafe impl<L: Lockable> Lockable for BoxedLockCollection<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(self.locks()) } @@ -74,14 +69,19 @@ unsafe impl<L: Lockable> Lockable for BoxedLockCollection<L> { unsafe fn guard(&self) -> Self::Guard<'_> { self.data().guard() } +} + +unsafe impl<L: Sharable> Sharable for BoxedLockCollection<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 BoxedLockCollection<L> {} - unsafe impl<L: OwnedLockable> OwnedLockable for BoxedLockCollection<L> {} impl<L> IntoIterator for BoxedLockCollection<L> diff --git a/src/collection/owned.rs b/src/collection/owned.rs index 3ea08b5..714ff01 100644 --- a/src/collection/owned.rs +++ b/src/collection/owned.rs @@ -58,11 +58,6 @@ unsafe impl<L: Lockable> Lockable for OwnedLockCollection<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>) { self.data.get_ptrs(ptrs) } @@ -70,10 +65,6 @@ unsafe impl<L: Lockable> Lockable for OwnedLockCollection<L> { unsafe fn guard(&self) -> Self::Guard<'_> { self.data.guard() } - - unsafe fn read_guard(&self) -> Self::ReadGuard<'_> { - self.data.read_guard() - } } impl<L: LockableIntoInner> LockableIntoInner for OwnedLockCollection<L> { @@ -84,7 +75,16 @@ impl<L: LockableIntoInner> LockableIntoInner for OwnedLockCollection<L> { } } -unsafe impl<L: Sharable> Sharable for OwnedLockCollection<L> {} +unsafe impl<L: Sharable> Sharable for OwnedLockCollection<L> { + type ReadGuard<'g> + = L::ReadGuard<'g> + where + Self: 'g; + + unsafe fn read_guard(&self) -> Self::ReadGuard<'_> { + self.data.read_guard() + } +} unsafe impl<L: OwnedLockable> OwnedLockable for OwnedLockCollection<L> {} 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)) diff --git a/src/collection/retry.rs b/src/collection/retry.rs index 42d86e5..0c44dea 100644 --- a/src/collection/retry.rs +++ b/src/collection/retry.rs @@ -219,11 +219,6 @@ unsafe impl<L: Lockable> Lockable for RetryingLockCollection<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>) { self.data.get_ptrs(ptrs) } @@ -231,10 +226,6 @@ unsafe impl<L: Lockable> Lockable for RetryingLockCollection<L> { unsafe fn guard(&self) -> Self::Guard<'_> { self.data.guard() } - - unsafe fn read_guard(&self) -> Self::ReadGuard<'_> { - self.data.read_guard() - } } impl<L: LockableAsMut> LockableAsMut for RetryingLockCollection<L> { @@ -256,7 +247,16 @@ impl<L: LockableIntoInner> LockableIntoInner for RetryingLockCollection<L> { } } -unsafe impl<L: Sharable> Sharable for RetryingLockCollection<L> {} +unsafe impl<L: Sharable> Sharable for RetryingLockCollection<L> { + type ReadGuard<'g> + = L::ReadGuard<'g> + where + Self: 'g; + + unsafe fn read_guard(&self) -> Self::ReadGuard<'_> { + self.data.read_guard() + } +} unsafe impl<L: OwnedLockable> OwnedLockable for RetryingLockCollection<L> {} |
