diff options
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. /// |
