vthread 0.0.1

Bounded carrier-affine virtual threads for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use crate::{Error, run, yield_now};

#[test]
fn convenience_run_executes_a_scope() {
    let value = run(|scope| scope.spawn("answer", || 42)?.join()).expect("run succeeds");
    assert_eq!(value, 42);
}

#[test]
fn yielding_outside_a_virtual_thread_is_an_error() {
    assert!(matches!(yield_now(), Err(Error::OutsideVThread)));
}