Trait AsyncIterator

Source
pub trait AsyncIterator {
    type Item;

    // Required method
    fn next_async(&mut self) -> impl Future<Output = Option<Self::Item>>;

    // Provided methods
    fn sync_iter(
        &mut self,
    ) -> impl Future<Output = SyncIter<IntoIter<Self::Item>>>
       where Self: Sized { ... }
    fn async_size_hint(&self) -> (usize, Option<usize>) { ... }
    fn async_collect<B>(self) -> impl Future<Output = B>
       where Self: Sized,
             B: FromIterator<Self::Item> { ... }
}

Required Associated Types§

Required Methods§

Source

fn next_async(&mut self) -> impl Future<Output = Option<Self::Item>>

Provided Methods§

Source

fn sync_iter(&mut self) -> impl Future<Output = SyncIter<IntoIter<Self::Item>>>
where Self: Sized,

Source

fn async_size_hint(&self) -> (usize, Option<usize>)

Source

fn async_collect<B>(self) -> impl Future<Output = B>
where Self: Sized, B: FromIterator<Self::Item>,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<B, I, F, Fut> AsyncIterator for AsyncMap<I, F>
where I: AsyncIterator, F: FnMut(I::Item) -> Fut + Send, Fut: Future<Output = B> + Send,

Source§

type Item = B

Source§

impl<I, F, Fut> AsyncIterator for AsyncFilter<I, F>
where I: AsyncIterator, F: FnMut(I::Item) -> Fut, Fut: Future<Output = bool>, I::Item: Clone,

Source§

impl<T> AsyncIterator for T
where T: Iterator + ?Sized,

Source§

type Item = <T as Iterator>::Item