diff options
Diffstat (limited to 'src')
| -rwxr-xr-x | src/collection/owned.rs | 10 | ||||
| -rwxr-xr-x | src/lib.rs | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/collection/owned.rs b/src/collection/owned.rs index 456742b..2172b96 100755 --- a/src/collection/owned.rs +++ b/src/collection/owned.rs @@ -1,3 +1,4 @@ +use crate::iterator::LockingIterator; use crate::lockable::{ Lockable, LockableGetMut, LockableIntoInner, OwnedLockable, RawLock, Sharable, }; @@ -642,6 +643,15 @@ impl<L: LockableIntoInner> OwnedLockCollection<L> { } } +impl<L: OwnedLockable> OwnedLockCollection<L> +where + for<'a> &'a L: IntoIterator, +{ + pub fn locking_iter(&self, key: ThreadKey) -> LockingIterator<<&L as IntoIterator>::IntoIter> { + LockingIterator::new(key, (&self.child).into_iter()) + } +} + #[cfg(test)] mod tests { use super::*; @@ -168,6 +168,7 @@ mod handle_unwind; mod key; pub mod collection; +pub mod iterator; pub mod lockable; pub mod mutex; pub mod poisonable; |
