summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMica White <botahamec@outlook.com>2026-03-07 15:53:50 -0600
committerMica White <botahamec@outlook.com>2026-03-07 15:53:50 -0600
commitfbdfc775bd1642a469f8a3fa0aa9beb91ca760d6 (patch)
treeed03623618c56dcc3e08d876fe39fb84ea60a905 /src
parentd7e9207295b6e609e540c7376f9293d3ef5c2f33 (diff)
Create basic locking iterator
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;