constellation-rs / constellation

Distributed programming for Rust.
Apache License 2.0
563 stars 24 forks source link

Implement a #[constellation::main] macro #67

Open alecmocatta opened 4 years ago

alecmocatta commented 4 years ago

Currently using tokio with contellation is a bit unwieldy:

fn main() {
    init(Resources::default());

    tokio::runtime::Builder::new()
        .threaded_scheduler()
        .enable_all()
        .build()
        .unwrap()
        .block_on(async {
            ...
        })
}

It could become:

#[constellation::main]
#[tokio::main]
async fn main() {
    ...
}

Or

#[constellation::tokio::main]
async fn main() {
    ...
}

Or just this if we specialise on tokio?

#[constellation::main]
async fn main() {
    ...
}