Skip to main content

main

Attribute Macro main 

Source
#[main]
Expand description

#[rustango::main] — the Django-shape runserver entrypoint. Wraps #[tokio::main] and a default tracing_subscriber initialisation (env-filter, falling back to info,sqlx=warn) so user main functions are zero-boilerplate:

#[rustango::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    rustango::server::Builder::from_env().await?
        .migrate("migrations").await?
        .api(my_app::urls::api())
        .seed_with(my_app::seed::run).await?
        .serve("0.0.0.0:8080").await
}

Optional flavor = "current_thread" passes through to #[tokio::main]; default is the multi-threaded runtime.

Pulls tracing-subscriber into the rustango crate behind the runtime sub-feature (implied by tenancy), so apps that opt out get plain #[tokio::main] ergonomics without the dependency.