From 6f6e030ea7edb9d155ebf21b5d42936c20801b50 Mon Sep 17 00:00:00 2001 From: Mica White Date: Sun, 16 Aug 2026 12:43:05 -0400 Subject: Implement LockContext --- src/collection/owned.rs | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) (limited to 'src/collection/owned.rs') diff --git a/src/collection/owned.rs b/src/collection/owned.rs index a7ab1b6..07a5402 100755 --- a/src/collection/owned.rs +++ b/src/collection/owned.rs @@ -1,4 +1,4 @@ -use crate::iterator::LockingIterator; +use crate::iterator::LockContext; use crate::lockable::{ Lockable, LockableGetMut, LockableIntoInner, OwnedLockable, RawLock, Sharable, }; @@ -559,6 +559,10 @@ impl OwnedLockCollection { } impl OwnedLockCollection { + pub const fn context(&self) -> LockContext<'_, L> { + LockContext::new(&self.child) + } + /// Gets the underlying collection, consuming this collection. /// /// # Examples @@ -641,27 +645,6 @@ impl OwnedLockCollection { } } -impl OwnedLockCollection -where - for<'a> &'a L: IntoIterator, -{ - pub fn locking_iter( - &self, - key: ThreadKey, - ) -> LockingIterator<<&L as IntoIterator>::IntoIter, ThreadKey> { - LockingIterator::new(key, (&self.child).into_iter()) - } - - pub fn scoped_locking_iter( - &self, - key: Key, - f: impl FnOnce(&mut LockingIterator<<&L as IntoIterator>::IntoIter, Key>) -> R, - ) -> R { - let mut iterator = LockingIterator::new(key, (&self.child).into_iter()); - f(&mut iterator) - } -} - #[cfg(test)] mod tests { use super::*; -- cgit v1.3.1