diff options
Diffstat (limited to 'src/collection')
| -rw-r--r-- | src/collection/owned.rs | 10 | ||||
| -rw-r--r-- | src/collection/retry.rs | 22 |
2 files changed, 30 insertions, 2 deletions
diff --git a/src/collection/owned.rs b/src/collection/owned.rs index 2b6e974..f2b6cc9 100644 --- a/src/collection/owned.rs +++ b/src/collection/owned.rs @@ -1,6 +1,6 @@ use std::marker::PhantomData; -use crate::lockable::{Lockable, OwnedLockable, RawLock, Sharable}; +use crate::lockable::{Lockable, LockableIntoInner, OwnedLockable, RawLock, Sharable}; use crate::Keyable; use super::{utils, LockGuard, OwnedLockCollection}; @@ -69,6 +69,14 @@ unsafe impl<L: Lockable> Lockable for OwnedLockCollection<L> { } } +impl<L: LockableIntoInner> LockableIntoInner for OwnedLockCollection<L> { + type Inner = L::Inner; + + fn into_inner(self) -> Self::Inner { + self.data.into_inner() + } +} + unsafe impl<L: Sharable> Sharable for OwnedLockCollection<L> {} unsafe impl<L: OwnedLockable> OwnedLockable for OwnedLockCollection<L> {} diff --git a/src/collection/retry.rs b/src/collection/retry.rs index b73788a..7aa4ef4 100644 --- a/src/collection/retry.rs +++ b/src/collection/retry.rs @@ -1,4 +1,6 @@ -use crate::lockable::{Lockable, OwnedLockable, RawLock, Sharable}; +use crate::lockable::{ + Lockable, LockableAsMut, LockableIntoInner, OwnedLockable, RawLock, Sharable, +}; use crate::Keyable; use std::collections::HashSet; @@ -174,6 +176,24 @@ unsafe impl<L: Lockable> Lockable for RetryingLockCollection<L> { } } +impl<L: LockableAsMut> LockableAsMut for RetryingLockCollection<L> { + type Inner<'a> = L::Inner<'a> + where + Self: 'a; + + fn as_mut(&mut self) -> Self::Inner<'_> { + self.data.as_mut() + } +} + +impl<L: LockableIntoInner> LockableIntoInner for RetryingLockCollection<L> { + type Inner = L::Inner; + + fn into_inner(self) -> Self::Inner { + self.data.into_inner() + } +} + unsafe impl<L: Sharable> Sharable for RetryingLockCollection<L> {} unsafe impl<L: OwnedLockable> OwnedLockable for RetryingLockCollection<L> {} |
