Trait axum_typed_routing::TypedRouter
source · pub trait TypedRouter: Sized {
type State: Clone + Send + Sync + 'static;
// Required method
fn typed_route(
self,
handler: fn() -> (&'static str, MethodRouter<Self::State>)
) -> Self;
}
Expand description
A trait that allows typed routes, created with the route
macro to
be added to an axum router.
Typed handlers are of the form fn() -> (&'static str, MethodRouter<S>)
, where
S
is the state type. The first element of the tuple is the path, and the second
is the method router.
Required Associated Types§
Required Methods§
sourcefn typed_route(
self,
handler: fn() -> (&'static str, MethodRouter<Self::State>)
) -> Self
fn typed_route( self, handler: fn() -> (&'static str, MethodRouter<Self::State>) ) -> Self
Add a typed route to the router, usually created with the route
macro.
Typed handlers are of the form fn() -> (&'static str, MethodRouter<S>)
, where
S
is the state type. The first element of the tuple is the path, and the second
is the method router.
Object Safety§
This trait is not object safe.