diff options
| author | Botahamec <botahamec@outlook.com> | 2024-05-21 13:18:10 -0400 |
|---|---|---|
| committer | Botahamec <botahamec@outlook.com> | 2024-05-21 13:18:10 -0400 |
| commit | 6e3aa5182604b30ef75ba5676e9f677cc1d18fe3 (patch) | |
| tree | d8e23a82c8151c4b49c15f49707d96651764db39 /src/collection/owned_collection.rs | |
| parent | 875d5c4ad6e0c2a78c15476584fc686121b340d3 (diff) | |
| parent | c344021797b7e1f8027bd9d1302908f0767e362b (diff) | |
Merge remote-tracking branch 'origin/0.2' into 0.2
Diffstat (limited to 'src/collection/owned_collection.rs')
| -rw-r--r-- | src/collection/owned_collection.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/collection/owned_collection.rs b/src/collection/owned_collection.rs index dbc9a45..ea8f2f2 100644 --- a/src/collection/owned_collection.rs +++ b/src/collection/owned_collection.rs @@ -4,22 +4,19 @@ use crate::{lockable::Lock, Keyable, Lockable, OwnedLockable}; use super::{LockGuard, OwnedLockCollection}; -fn get_locks<'a, L: Lockable<'a> + 'a>(data: &'a L) -> Vec<&'a dyn Lock> { +fn get_locks<L: Lockable>(data: &L) -> Vec<&dyn Lock> { let mut locks = Vec::new(); data.get_ptrs(&mut locks); locks } -impl<'a, L: OwnedLockable<'a>> OwnedLockCollection<L> { +impl<L: OwnedLockable> OwnedLockCollection<L> { #[must_use] pub const fn new(data: L) -> Self { Self { data } } - pub fn lock<'s: 'a, 'key, Key: Keyable + 'key>( - &'s self, - key: Key, - ) -> LockGuard<'a, 'key, L, Key> { + pub fn lock<'a, 'key, Key: Keyable + 'key>(&'a self, key: Key) -> LockGuard<'a, 'key, L, Key> { let locks = get_locks(&self.data); for lock in locks { // safety: we have the thread key, and these locks happen in a @@ -36,7 +33,7 @@ impl<'a, L: OwnedLockable<'a>> OwnedLockCollection<L> { } } - pub fn try_lock<'key: 'a, Key: Keyable + 'key>( + pub fn try_lock<'a, 'key: 'a, Key: Keyable + 'key>( &'a self, key: Key, ) -> Option<LockGuard<'a, 'key, L, Key>> { |
