This library provides a way to create asynchronous generator using the async/await feature in stable Rust.

Installation

Add it as a dependency to your Rust project by adding the following line to your Cargo.toml file:

toml [dependencies] async-gen = "0.2"

Examples

```rust use std::pin::pin; use async_gen::{gen, GeneratorState};

[tokio::main]

async fn main() { let g = gen! { yield 42; return "42" }; let mut g = pin!(g); asserteq!(g.resume().await, GeneratorState::Yielded(42)); asserteq!(g.resume().await, GeneratorState::Complete("42")); } ```