stuck

crates.io docs.rs github-ci mit-license

Stuck is a multi-threading scheduled task facility building on cooperative stackful coroutine.

Examples

```rust use stuck::runtime::Runtime; use stuck::{coroutine, task};

fn main() { let runtime = Runtime::new(); let twenty = runtime.spawn(|| { let five_coroutine = coroutine::spawn(|| 5);

    let (suspension, resumption) = coroutine::suspension::<i32>();
    coroutine::spawn(move || resumption.resume(5));

    let five_task = task::spawn(|| 5);

    let (session, waker) = task::session::<i32>();
    task::spawn(move || waker.wake(5));

    session.wait() + suspension.suspend() + five_coroutine.join().unwrap() + five_task.join().unwrap()
});
println!("twenty.join().unwrap(): {}", twenty.join().unwrap());

} ```

See tests for more examples.

LICENSE

MIT

Inspiration