pub trait AsyncIterator: Send {
type Item: Send;
// Required method
fn into_vec(self) -> Vec<Self::Item>
where Self: Sized;
// Provided methods
fn map<F, Fut, R>(self, map_fn: F) -> AsyncMap<Self, F>
where Self: Sized,
F: Fn(Self::Item) -> Fut + Send + Sync,
Fut: Future<Output = R> + Send,
R: Send { ... }
fn filter<F, Fut>(self, filter_fn: F) -> AsyncFilter<Self, F>
where Self: Sized,
F: Fn(&Self::Item) -> Fut + Send + Sync,
Fut: Future<Output = bool> + Send { ... }
fn take(self, count: usize) -> AsyncTake<Self>
where Self: Sized { ... }
fn skip(self, count: usize) -> AsyncSkip<Self>
where Self: Sized { ... }
fn enumerate(self) -> AsyncEnumerate<Self>
where Self: Sized { ... }
fn zip<J>(self, other: J) -> AsyncZip<Self, J>
where Self: Sized,
J: AsyncIterator { ... }
fn for_each<F, Fut>(self, func: F) -> AsyncForEach<Self, F> ⓘ
where Self: Sized,
F: Fn(Self::Item) -> Fut + Send + Sync,
Fut: Future<Output = ()> + Send { ... }
fn collect<C>(self) -> AsyncCollect<Self, C> ⓘ
where Self: Sized,
C: Default + Extend<Self::Item> + Send { ... }
fn fold<T, F, Fut>(self, init: T, fold_fn: F) -> AsyncFold<Self, T, F> ⓘ
where Self: Sized,
F: Fn(T, Self::Item) -> Fut + Send + Sync,
Fut: Future<Output = T> + Send,
T: Send { ... }
fn reduce<F, Fut>(self, reduce_fn: F) -> AsyncReduce<Self, F> ⓘ
where Self: Sized,
F: Fn(Self::Item, Self::Item) -> Fut + Send + Sync,
Fut: Future<Output = Self::Item> + Send { ... }
fn into_parallel(self) -> AsyncParallelAdapter<Self>
where Self: Sized { ... }
}Expand description
Core async iterator trait for async/await compatible iteration
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn map<F, Fut, R>(self, map_fn: F) -> AsyncMap<Self, F>
fn map<F, Fut, R>(self, map_fn: F) -> AsyncMap<Self, F>
Async map operation that transforms each element
Sourcefn filter<F, Fut>(self, filter_fn: F) -> AsyncFilter<Self, F>
fn filter<F, Fut>(self, filter_fn: F) -> AsyncFilter<Self, F>
Async filter operation
Sourcefn take(self, count: usize) -> AsyncTake<Self>where
Self: Sized,
fn take(self, count: usize) -> AsyncTake<Self>where
Self: Sized,
Retain at most count items from the logical async stream prefix.
Sourcefn skip(self, count: usize) -> AsyncSkip<Self>where
Self: Sized,
fn skip(self, count: usize) -> AsyncSkip<Self>where
Self: Sized,
Discard count items from the logical async stream prefix.
Sourcefn enumerate(self) -> AsyncEnumerate<Self>where
Self: Sized,
fn enumerate(self) -> AsyncEnumerate<Self>where
Self: Sized,
Pair each item with its zero-based logical stream position.
Sourcefn zip<J>(self, other: J) -> AsyncZip<Self, J>where
Self: Sized,
J: AsyncIterator,
fn zip<J>(self, other: J) -> AsyncZip<Self, J>where
Self: Sized,
J: AsyncIterator,
Pair items with another async iterator, stopping at the shorter input.
Sourcefn for_each<F, Fut>(self, func: F) -> AsyncForEach<Self, F> ⓘ
fn for_each<F, Fut>(self, func: F) -> AsyncForEach<Self, F> ⓘ
Async for_each operation with side effects
Sourcefn collect<C>(self) -> AsyncCollect<Self, C> ⓘ
fn collect<C>(self) -> AsyncCollect<Self, C> ⓘ
Collect into a vector asynchronously
Sourcefn fold<T, F, Fut>(self, init: T, fold_fn: F) -> AsyncFold<Self, T, F> ⓘ
fn fold<T, F, Fut>(self, init: T, fold_fn: F) -> AsyncFold<Self, T, F> ⓘ
Fold operation with async function
Sourcefn reduce<F, Fut>(self, reduce_fn: F) -> AsyncReduce<Self, F> ⓘ
fn reduce<F, Fut>(self, reduce_fn: F) -> AsyncReduce<Self, F> ⓘ
Reduce operation for async iterators
Sourcefn into_parallel(self) -> AsyncParallelAdapter<Self>where
Self: Sized,
fn into_parallel(self) -> AsyncParallelAdapter<Self>where
Self: Sized,
Convert to parallel iterator for hybrid processing
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".