Crate yield_return

Source
Expand description

This crate provides a way to implement something like C#’s yield return using an asynchronous function.

§Example

use yield_return::Yield;
let iter = Yield::new(|mut y| async move {
    y.ret(1).await;
    y.ret(2).await;
});
let list: Vec<_> = iter.collect();
assert_eq!(list, vec![1, 2]);

§Available Types

This crate provides several iterator types that differ based on two characteristics:

The following table shows the available types:

Structs§

AsyncIter
Send stream implemented using async functions.
AsyncIterContext
Send stream context.
Iter
Send iterator implemented using async functions.
IterContext
Send iterator context.
LocalAsyncIter
Non-Send stream implemented using async functions.
LocalAsyncIterContext
Non-Send stream context.
LocalIter
Non-Send iterator implemented using async functions.
LocalIterContext
Non-Send iterator context.

Type Aliases§

YieldDeprecated
YieldContextDeprecated