Skip to main content

Router

Type Alias Router 

Source
pub type Router<S = ()> = Router<S>;
Expand description

Re-export Axum’s Router type

Note: In Axum’s type system, Router<S> means a router that “needs” state of type S.

  • Router<()> = a stateless router (needs no state)
  • Router<AppState> = a router that needs AppState to be provided via .with_state()

Users should use router::build() to create routers rather than importing this type.

Aliased Type§

pub struct Router<S = ()> { /* private fields */ }

Trait Implementations§

Source§

impl<S> RouterExt<S> for Router<S>

Source§

fn finish(self) -> Router<S>

Finishes building the router and returns it Read more