async_coroutine

Crates.ioasync_coroutine
lib.rsasync_coroutine
version0.2.0
created_at2025-07-08 21:26:46.65252+00
updated_at2025-07-08 21:28:41.668968+00
descriptionA coroutine implementation based on Rust's async/await syntax.
homepage
repositoryhttps://github.com/jannik4/async_coroutine
max_upload_size
id1743618
size26,747
Jannik Obermann (jannik4)

documentation

README

Async Coroutine

License Build Status crates.io docs.rs

This crate provides a coroutine implementation based on Rust's async/await syntax.

Usage

use async_coroutine::{Coroutine, State};

let mut co = Coroutine::new(|handle, value| async move {
    assert_eq!(value, 1);
    assert_eq!(handle.yield_(true).await, 2);
    assert_eq!(handle.yield_(false).await, 3);
    "Bye"
});

assert_eq!(co.resume_with(1), State::Yield(true));
assert_eq!(co.resume_with(2), State::Yield(false));
assert_eq!(co.resume_with(3), State::Complete("Bye"));
Commit count: 0

cargo fmt