Skip to main content

main

Attribute Macro main 

Source
#[main]
Expand description

Marks fn main as the runite entry point.

Works for both synchronous and async entry points. An async fn main has its future driven to completion with runite::block_on, so the program ends when main’s future resolves (like std’s main, any still-running background tasks are abandoned) and the function’s return value is honored: an async fn main() -> Result<…> that returns Err reports a non-zero exit status through std::process::Termination, instead of silently exiting 0. A synchronous fn main runs its body, drives the event loop to drain any tasks it spawned via runite::run, then returns its value.

To use a renamed runite dependency, pass the path: #[runite::main(crate = "my_runite")].