Crate async_main

Source
Expand description

Runtime-agnostic async main proc macro. Currently, this crate only supports single-threaded task pools, but in a future version will add a configuration option to enable multi-threaded task pools.

§Getting Started

Choose a runtime by enabling one of the following features:

  • async-executor
  • async-std
  • futures
  • pasts
  • tokio
use async_main::{async_main, LocalSpawner};

#[async_main]
async fn main(_spawner: LocalSpawner) {
    println!("Hello, world!");
}

Structs§

LocalSpawner
Handle to a !Send asynchronous task spawner.

Traits§

Spawn
Implementation for spawning tasks on an executor.

Attribute Macros§

async_main
Mark the entry point of the program.