pub struct ThreadsafePooledIter<I, BorrowedItem: ToOwned> { /* private fields */ }anchored-pool only.Expand description
Convert a CursorLendingIterator into a CursorPooledIterator by storing recently
accessed items in reusable buffers.
This effectively allows the iterator to lend out multiple items at once, unlike a lending iterator which can only lend out one. This comes primarily at the cost of extra copying into buffers, and in memory usage. The costs of allocating buffers is likely amortized by their reuse.
Implementations§
Trait Implementations§
Source§impl<I, BorrowedItem> CursorPooledIterator for ThreadsafePooledIter<I, BorrowedItem>where
I: CursorLendingIterator,
BorrowedItem: ToOwned,
for<'lend> LentItem<'lend, I>: Borrow<BorrowedItem>,
impl<I, BorrowedItem> CursorPooledIterator for ThreadsafePooledIter<I, BorrowedItem>where
I: CursorLendingIterator,
BorrowedItem: ToOwned,
for<'lend> LentItem<'lend, I>: Borrow<BorrowedItem>,
Source§fn current(&self) -> Option<Self::Item>
fn current(&self) -> Option<Self::Item>
Get the current value the iterator is at, if the iterator is valid.
May need to wait for a buffer to become available.
§Potential Panics or Deadlocks
If self.buffer_pool_size() == 0, then this method panics.
This method may also cause a deadlock if no buffers are currently available, and the
current thread needs to make progress in order to release a buffer.
Source§fn prev(&mut self) -> Option<Self::Item>
fn prev(&mut self) -> Option<Self::Item>
Move the iterator one position back, and return the entry at that position.
Returns None if the iterator was at the last entry.
May need to wait for a buffer to become available.
§Potential Panics or Deadlocks
If self.buffer_pool_size() == 0, then this method panics.
This method may also cause a deadlock if no buffers are currently available, and the
current thread needs to make progress in order to release a buffer.
Source§fn valid(&self) -> bool
fn valid(&self) -> bool
Source§fn try_current(&self) -> Result<Option<Self::Item>, OutOfBuffers>
fn try_current(&self) -> Result<Option<Self::Item>, OutOfBuffers>
Source§impl<I: Debug, BorrowedItem: Debug + ToOwned> Debug for ThreadsafePooledIter<I, BorrowedItem>
impl<I: Debug, BorrowedItem: Debug + ToOwned> Debug for ThreadsafePooledIter<I, BorrowedItem>
Source§impl<I, BorrowedItem> PooledIterator for ThreadsafePooledIter<I, BorrowedItem>where
I: CursorLendingIterator,
BorrowedItem: ToOwned,
for<'lend> LentItem<'lend, I>: Borrow<BorrowedItem>,
impl<I, BorrowedItem> PooledIterator for ThreadsafePooledIter<I, BorrowedItem>where
I: CursorLendingIterator,
BorrowedItem: ToOwned,
for<'lend> LentItem<'lend, I>: Borrow<BorrowedItem>,
Source§fn next(&mut self) -> Option<Self::Item>
fn next(&mut self) -> Option<Self::Item>
Move the iterator one position forwards, and return the entry at that position.
Returns None if the iterator was at the last entry.
May need to wait for a buffer to become available.
§Potential Panics or Deadlocks
If self.buffer_pool_size() == 0, then this method panics.
This method may also cause a deadlock if no buffers are currently available, and the
current thread needs to make progress in order to release a buffer.
Source§type Item = ThreadsafePoolItem<<BorrowedItem as ToOwned>::Owned>
type Item = ThreadsafePoolItem<<BorrowedItem as ToOwned>::Owned>
Source§fn try_next(&mut self) -> Result<Option<Self::Item>, OutOfBuffers>
fn try_next(&mut self) -> Result<Option<Self::Item>, OutOfBuffers>
Ok(None) if the iterator was at the last entry. Read moreSource§fn buffer_pool_size(&self) -> usize
fn buffer_pool_size(&self) -> usize
Source§fn available_buffers(&self) -> usize
fn available_buffers(&self) -> usize
Source§fn into_lender(self) -> PooledLenderAdapter<Self>where
Self: Sized,
fn into_lender(self) -> PooledLenderAdapter<Self>where
Self: Sized,
lender only.PooledIterator into a lender::Lender lending iterator which only uses
one buffer at a time. Read moreSource§fn into_lending_iterator(self) -> PooledLendingIteratorAdapter<Self>where
Self: Sized,
fn into_lending_iterator(self) -> PooledLendingIteratorAdapter<Self>where
Self: Sized,
lending-iterator only.PooledIterator into a lending_iterator::LendingIterator which only uses
one buffer at a time. Read moreSource§impl<I, BorrowedItem, Key, Cmp> Seekable<Key, Cmp> for ThreadsafePooledIter<I, BorrowedItem>where
I: CursorLendingIterator + Seekable<Key, Cmp>,
BorrowedItem: ToOwned,
Key: ?Sized,
Cmp: Comparator<Key>,
for<'lend> LentItem<'lend, I>: Borrow<BorrowedItem>,
impl<I, BorrowedItem, Key, Cmp> Seekable<Key, Cmp> for ThreadsafePooledIter<I, BorrowedItem>where
I: CursorLendingIterator + Seekable<Key, Cmp>,
BorrowedItem: ToOwned,
Key: ?Sized,
Cmp: Comparator<Key>,
for<'lend> LentItem<'lend, I>: Borrow<BorrowedItem>,
Source§fn reset(&mut self)
fn reset(&mut self)
Source§fn seek(&mut self, min_bound: &Key)
fn seek(&mut self, min_bound: &Key)
min_bound. Read moreSource§fn seek_before(&mut self, strict_upper_bound: &Key)
fn seek_before(&mut self, strict_upper_bound: &Key)
strict_upper_bound. Read moreSource§fn seek_to_first(&mut self)
fn seek_to_first(&mut self)
Source§fn seek_to_last(&mut self)
fn seek_to_last(&mut self)
Auto Trait Implementations§
impl<I, BorrowedItem> Freeze for ThreadsafePooledIter<I, BorrowedItem>where
I: Freeze,
impl<I, BorrowedItem> !RefUnwindSafe for ThreadsafePooledIter<I, BorrowedItem>
impl<I, BorrowedItem> Send for ThreadsafePooledIter<I, BorrowedItem>
impl<I, BorrowedItem> Sync for ThreadsafePooledIter<I, BorrowedItem>
impl<I, BorrowedItem> Unpin for ThreadsafePooledIter<I, BorrowedItem>where
I: Unpin,
impl<I, BorrowedItem> !UnwindSafe for ThreadsafePooledIter<I, BorrowedItem>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FragileContainer<T> for Twhere
T: ?Sized,
impl<T> FragileContainer<T> for Twhere
T: ?Sized,
Source§fn get_ref(&self) -> <T as FragileTryContainer<T>>::Ref<'_>
fn get_ref(&self) -> <T as FragileTryContainer<T>>::Ref<'_>
Infallibly get immutable access to the T.
Source§impl<T> FragileMutContainer<T> for Twhere
T: ?Sized,
impl<T> FragileMutContainer<T> for Twhere
T: ?Sized,
Source§fn get_mut(&mut self) -> <T as FragileTryMutContainer<T>>::RefMut<'_>
fn get_mut(&mut self) -> <T as FragileTryMutContainer<T>>::RefMut<'_>
Infallibly get mutable access to the T.
Source§impl<T> FragileTryContainer<T> for Twhere
T: ?Sized,
impl<T> FragileTryContainer<T> for Twhere
T: ?Sized,
Source§fn into_inner(self) -> Option<T>
fn into_inner(self) -> Option<T>
Infallibly get the T.
Source§fn try_get_ref(
&self,
) -> Result<<T as FragileTryContainer<T>>::Ref<'_>, <T as FragileTryContainer<T>>::RefError>
fn try_get_ref( &self, ) -> Result<<T as FragileTryContainer<T>>::Ref<'_>, <T as FragileTryContainer<T>>::RefError>
Infallibly get immutable access to the T.
Source§type RefError = Infallible
type RefError = Infallible
try_get_ref. This type should implement
std::error::Error. Read moreSource§fn new_container(t: T) -> T
fn new_container(t: T) -> T
T.Source§impl<T> FragileTryMutContainer<T> for Twhere
T: ?Sized,
impl<T> FragileTryMutContainer<T> for Twhere
T: ?Sized,
Source§fn try_get_mut(
&mut self,
) -> Result<<T as FragileTryMutContainer<T>>::RefMut<'_>, <T as FragileTryMutContainer<T>>::RefMutError>
fn try_get_mut( &mut self, ) -> Result<<T as FragileTryMutContainer<T>>::RefMut<'_>, <T as FragileTryMutContainer<T>>::RefMutError>
Infallibly get mutable access to the T.
Source§type RefMut<'a> = &'a mut T
where
T: 'a
type RefMut<'a> = &'a mut T where T: 'a
Source§type RefMutError = Infallible
type RefMutError = Infallible
try_get_mut. This type should implement
std::error::Error. Read more