Crate coroutine [] [src]

Coroutine implementation in Rust.

Example

use coroutine::asymmetric::*;

let mut coro = Coroutine::spawn(|coro, val| {
    println!("Inside {}", val);
    coro.yield_with(val + 1)
});

println!("Resume1 {}", coro.resume(0).unwrap());
println!("Resume2 {}", coro.resume(2).unwrap());

This will prints

Inside 0
Resume1 1
Resume2 2

Modules

asymmetric

Asymmetric coroutines

Structs

Options

Coroutine spawn options

Enums

Error

Resume Error

Type Definitions

Result

Return type of resuming. Ok if resume successfully with the current state, Err if resume failed with Error.