summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/collection/owned.rs10
-rwxr-xr-xsrc/lib.rs1
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::*;
diff --git a/src/lib.rs b/src/lib.rs
index 2139d6b..15d5ca5 100755
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -168,6 +168,7 @@ mod handle_unwind;
mod key;
pub mod collection;
+pub mod iterator;
pub mod lockable;
pub mod mutex;
pub mod poisonable;