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> ApiRoute<S> for Router<S>
impl<S> ApiRoute<S> for Router<S>
Source§fn api_route<H, T>(
self,
route_info: (&'static str, &'static str),
handler: H,
) -> Selfwhere
H: Handler<T, S>,
T: 'static,
fn api_route<H, T>(
self,
route_info: (&'static str, &'static str),
handler: H,
) -> Selfwhere
H: Handler<T, S>,
T: 'static,
Register a handler using the
(path, method) tuple produced by a route
macro annotation. The HTTP verb is taken from the tuple — it cannot be
overridden at the call site.