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§
- Async
Iter Sendstream implemented using async functions.- Async
Iter Context Sendstream context.- Iter
Senditerator implemented using async functions.- Iter
Context Senditerator context.- Local
Async Iter - Non-
Sendstream implemented using async functions. - Local
Async Iter Context - Non-
Sendstream context. - Local
Iter - Non-
Senditerator implemented using async functions. - Local
Iter Context - Non-
Senditerator context.
Type Aliases§
- Yield
Deprecated - Yield
Context Deprecated