llam 0.1.4

Safe, Go-style Rust bindings for the LLAM runtime
use std::time::Duration;

#[llam::main]
fn main() -> llam::Result<()> {
    let (tx, rx) = llam::channel::bounded::<u64>(16)?;

    for i in 0..4 {
        let tx = tx.clone();
        llam::spawn!(move {
            tx.send(i * 2).expect("send failed");
        });
    }
    drop(tx);

    let mut sum = 0;
    while let Ok(value) = rx.recv_timeout(Duration::from_millis(50)) {
        sum += value;
    }

    println!("LLAM-rs sum={sum}");
    Ok(())
}