summaryrefslogtreecommitdiff
path: root/src/collection/owned.rs
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/collection/owned.rs
parentd7e9207295b6e609e540c7376f9293d3ef5c2f33 (diff)
Create basic locking iterator
Diffstat (limited to 'src/collection/owned.rs')
-rwxr-xr-xsrc/collection/owned.rs10
1 files changed, 10 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::*;