#[main]Expand description
Runs an async function on the ntex runtime.
Re-exported as ntex::main.
The function becomes a normal blocking function. When called, it builds a
System, runs the body to completion and returns its result, so the
function can return a value, for example std::io::Result<()>. It does
not have to be main.
#[ntex::main]
async fn main() -> std::io::Result<()> {
println!("Hello world");
Ok(())
}ยงArguments
name = "..."- name of the system. Defaults to the function name.signals = true/false- handle process signals. Off by default.panic_handling = true/false- report application panics asSignal::Panic. Only useful together withsignals = true. Off by default.ping_interval = N- how often, in milliseconds, the system pings its arbiters to spot busy ones. Defaults to 2000, zero turns pings off.rt = path- the runtime to run on, a value that implementsntex::rt::Runner. Defaults tontex::rt::DefaultRuntime, the runtime picked by ntex features.
#[ntex::main(name = "server", signals = true, ping_interval = 250)]
async fn main() {
println!("Hello world");
}