Skip to main content

LayerIterator

Trait LayerIterator 

Source
pub trait LayerIterator<K, V>: Send + Sync {
    // Required methods
    fn advance(&mut self) -> impl Future<Output = Result<(), Error>> + Send
       where Self: Sized;
    fn advance_dyn<'a>(
        &'a mut self,
    ) -> Result<Option<BoxFuture<'a, Result<(), Error>>>, Error>;
    fn get(&self) -> Option<ItemRef<'_, K, V>>;

    // Provided method
    fn filter<P>(
        self,
        predicate: P,
    ) -> impl Future<Output = Result<FilterLayerIterator<Self, P, K, V>, Error>> + Send
       where P: for<'b> Fn(ItemRef<'b, K, V>) -> bool + Send + Sync,
             Self: Sized,
             K: Send + Sync,
             V: Send + Sync { ... }
}
Expand description

Something that implements LayerIterator is returned by the seek function.

Required Methods§

Source

fn advance(&mut self) -> impl Future<Output = Result<(), Error>> + Send
where Self: Sized,

Advances the iterator (static dispatch, unboxed future).

Source

fn advance_dyn<'a>( &'a mut self, ) -> Result<Option<BoxFuture<'a, Result<(), Error>>>, Error>

Advances the iterator for dynamic dispatch (trait objects). If the iterator advances synchronously, returns Ok(None).

Source

fn get(&self) -> Option<ItemRef<'_, K, V>>

Returns the current item. This will be None if called when the iterator is first crated i.e. before either seek or advance has been called, and None if the iterator has reached the end of the layer.

Provided Methods§

Source

fn filter<P>( self, predicate: P, ) -> impl Future<Output = Result<FilterLayerIterator<Self, P, K, V>, Error>> + Send
where P: for<'b> Fn(ItemRef<'b, K, V>) -> bool + Send + Sync, Self: Sized, K: Send + Sync, V: Send + Sync,

Creates an iterator that only yields items from the underlying iterator for which predicate returns true.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a, K: Key + LayerKey + OrdLowerBound, V: Value> LayerIterator<K, V> for MergerIterator<'a, '_, K, V>

Source§

impl<'iter, K, V> LayerIterator<K, V> for BoxedLayerIterator<'iter, K, V>

Source§

impl<I, P, K, V> LayerIterator<K, V> for FilterLayerIterator<I, P, K, V>
where I: LayerIterator<K, V>, P: for<'b> Fn(ItemRef<'b, K, V>) -> bool + Send + Sync, K: Send + Sync, V: Send + Sync,

Source§

impl<I: LayerIterator<AllocatorKey, AllocatorValue>> LayerIterator<AllocatorKeyV32, AllocatorValueV32> for CoalescingIterator<I>

Source§

impl<K: Key, V: LayerValue> LayerIterator<K, V> for SkipListLayerIter<'_, K, V>