Skip to main content

runtime

Attribute Macro runtime 

Source
#[runtime]
Expand description

Mark the main function to use the GoRust runtime

ยงExample

use gorust::{runtime, go, make_chan};

#[runtime]
fn main() {
    go(|| {
        debug!("Hello from goroutine!");
    });
     
    let ch = make_chan!(i32, 10);
    go(move || {
        ch.send(42).unwrap();
    });
     
    debug!("Received: {}", ch.recv().unwrap());
}