Skip to main content

RouterBuilder

Trait RouterBuilder 

Source
pub trait RouterBuilder: Send + Sync {
    // Required method
    fn build_router(self: Arc<Self>, app: &App) -> Router;
}
Expand description

Builds the axum::Router contributed by a type to an HTTP server.

Implement this for any value that exposes routes. The builder is handed the fully built App, so it can resolve other components (services, registries, configuration) while assembling its routes.

Register an implementor with AddRouterExt::add_router (a concrete instance) or AddRouterServiceExt::add_router_service (resolved from a Service). The server merges every registered router into one.

Required Methods§

Source

fn build_router(self: Arc<Self>, app: &App) -> Router

Builds this type’s routes into a Router.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§