diff options
| author | Mica White <botahamec@outlook.com> | 2026-08-26 21:03:22 -0400 |
|---|---|---|
| committer | Mica White <botahamec@outlook.com> | 2026-08-26 21:03:22 -0400 |
| commit | 0a6bd8f2c0a7c79d17f5dc9e64af0b4c6c745166 (patch) | |
| tree | 30f115f637422040ad64da73eb5edd0552ae4bee /src/context/iterator.rs | |
| parent | 55b3a2425b242fbc5c6e471f220eeb8b949e8751 (diff) | |
Comments
Diffstat (limited to 'src/context/iterator.rs')
| -rw-r--r-- | src/context/iterator.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/context/iterator.rs b/src/context/iterator.rs index cc3bd7c..1eacaea 100644 --- a/src/context/iterator.rs +++ b/src/context/iterator.rs @@ -315,6 +315,7 @@ impl<'c, L: 'c + Iterator<Item = &'c I>, I: 'c + RawLock + Lockable, O> LockingI /// let last = iter.lock_last().unwrap(); /// assert_eq!(**last, 8); /// ``` + // I'm honestly not sure why anyone would use this pub fn lock_last(self) -> Option<ContextGuard<'c, <I as Lockable>::Guard<'c>, ThreadKey>> { self.iterator.last().map(|lock| unsafe { lock.raw_write(); @@ -542,6 +543,12 @@ impl<'c, L: 'c + Iterator<Item = &'c I>, I: 'c + RawLock + Sharable, O> } } +// Most of these methods are wrappers around Iterator methods. I didn't +// implement all of them. Some of them don't make sense for this type of +// collection, like rposition. Many iterator methods also take closures, and I +// wasn't sure if people would want a reference to the lock or the value inside +// the lock. In retrospect, we can't actually allow people to see references to +// the locks, so maybe we should just settle for values inside locks. impl<'l, L: Iterator, O> LockingIterator<'l, L, O> { /// Advances the iterator, without locking the next element in the iterator. /// |
