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