Skip to main content

BatchedAsyncIterator

Trait BatchedAsyncIterator 

Source
pub trait BatchedAsyncIterator<E: Send + Sync + 'static>: AsyncIterator<E> {
    // Required methods
    fn next_batch<'life0, 'async_trait>(
        &'life0 mut self,
        max_num: Option<usize>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Item>, E>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn items_remaining(&self) -> Option<usize>;
}

Required Methods§

Source

fn next_batch<'life0, 'async_trait>( &'life0 mut self, max_num: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Item>, E>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return a block of items. If the stream is done, then an empty vector is returned; otherwise, at least one item is returned.

If given, max_num dictates the maximum number of items to return. If None, then all available items are returned.

Source

fn items_remaining(&self) -> Option<usize>

Returns the number of items remaining in the stream if known, and None otherwise. Returns Some(0) if there are no items remaining.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§