Struct gotham::router::builder::SingleRouteBuilder
source · pub struct SingleRouteBuilder<'a, M, C, P, PE, QSE>where
M: RouteMatcher + Send + Sync + 'static,
C: PipelineHandleChain<P> + Send + Sync + 'static,
P: Send + Sync + 'static,
PE: PathExtractor<Body> + Send + Sync + 'static,
QSE: QueryStringExtractor<Body> + Send + Sync + 'static,{ /* private fields */ }
Expand description
Implements the traits required to define a single route, after determining which request paths
will be dispatched here. The DefineSingleRoute
trait has documentation for using this type.
Trait Implementations§
source§impl<'a, M, C, P, PE, QSE> DefineSingleRoute for SingleRouteBuilder<'a, M, C, P, PE, QSE>where
M: RouteMatcher + Send + Sync + 'static,
C: PipelineHandleChain<P> + Send + Sync + 'static,
P: RefUnwindSafe + Send + Sync + 'static,
PE: PathExtractor<Body> + Send + Sync + 'static,
QSE: QueryStringExtractor<Body> + Send + Sync + 'static,
impl<'a, M, C, P, PE, QSE> DefineSingleRoute for SingleRouteBuilder<'a, M, C, P, PE, QSE>where
M: RouteMatcher + Send + Sync + 'static,
C: PipelineHandleChain<P> + Send + Sync + 'static,
P: RefUnwindSafe + Send + Sync + 'static,
PE: PathExtractor<Body> + Send + Sync + 'static,
QSE: QueryStringExtractor<Body> + Send + Sync + 'static,
source§fn to<H>(self, handler: H)where
H: Handler + RefUnwindSafe + Copy + Send + Sync + 'static,
fn to<H>(self, handler: H)where
H: Handler + RefUnwindSafe + Copy + Send + Sync + 'static,
Directs the route to the given
Handler
, automatically creating a NewHandler
which
copies the Handler
. This is the easiest option for code which is using bare functions as
Handler
functions. Read moresource§fn to_async<H, Fut>(self, handler: H)where
Self: Sized,
H: FnOnce(State) -> Fut + RefUnwindSafe + Copy + Send + Sync + 'static,
Fut: Future<Output = HandlerResult> + Send + 'static,
fn to_async<H, Fut>(self, handler: H)where
Self: Sized,
H: FnOnce(State) -> Fut + RefUnwindSafe + Copy + Send + Sync + 'static,
Fut: Future<Output = HandlerResult> + Send + 'static,
source§fn to_async_borrowing<F>(self, handler: F)where
Self: Sized,
F: HandlerMarker + Copy + Send + Sync + RefUnwindSafe + 'static,
fn to_async_borrowing<F>(self, handler: F)where
Self: Sized,
F: HandlerMarker + Copy + Send + Sync + RefUnwindSafe + 'static,
source§fn to_new_handler<NH>(self, new_handler: NH)where
NH: NewHandler + 'static,
fn to_new_handler<NH>(self, new_handler: NH)where
NH: NewHandler + 'static,
Directs the route to the given
NewHandler
. This gives more control over how Handler
values are constructed. Read moresource§fn with_path_extractor<NPE>(self) -> <Self as ReplacePathExtractor<NPE>>::Outputwhere
NPE: PathExtractor<Body> + Send + Sync + 'static,
fn with_path_extractor<NPE>(self) -> <Self as ReplacePathExtractor<NPE>>::Outputwhere
NPE: PathExtractor<Body> + Send + Sync + 'static,
Applies a
PathExtractor
type to the current route, to extract path parameters into
State
with the given type. Read moresource§fn with_query_string_extractor<NQSE>(
self
) -> <Self as ReplaceQueryStringExtractor<NQSE>>::Outputwhere
NQSE: QueryStringExtractor<Body> + Send + Sync + 'static,
fn with_query_string_extractor<NQSE>(
self
) -> <Self as ReplaceQueryStringExtractor<NQSE>>::Outputwhere
NQSE: QueryStringExtractor<Body> + Send + Sync + 'static,
Applies a
QueryStringExtractor
type to the current route, to extract query parameters into
State
with the given type. Read moresource§fn add_route_matcher<NRM>(
self,
matcher: NRM
) -> <Self as ExtendRouteMatcher<NRM>>::Outputwhere
NRM: RouteMatcher + Send + Sync + 'static,
fn add_route_matcher<NRM>(
self,
matcher: NRM
) -> <Self as ExtendRouteMatcher<NRM>>::Outputwhere
NRM: RouteMatcher + Send + Sync + 'static,
Adds additional
RouteMatcher
requirements to the current route. Read moresource§impl<'a, M, NRM, C, P, PE, QSE> ExtendRouteMatcher<NRM> for SingleRouteBuilder<'a, M, C, P, PE, QSE>where
M: RouteMatcher + Send + Sync + 'static,
NRM: RouteMatcher + Send + Sync + 'static,
C: PipelineHandleChain<P> + Send + Sync + 'static,
P: RefUnwindSafe + Send + Sync + 'static,
PE: PathExtractor<Body> + Send + Sync + 'static,
QSE: QueryStringExtractor<Body> + Send + Sync + 'static,
impl<'a, M, NRM, C, P, PE, QSE> ExtendRouteMatcher<NRM> for SingleRouteBuilder<'a, M, C, P, PE, QSE>where
M: RouteMatcher + Send + Sync + 'static,
NRM: RouteMatcher + Send + Sync + 'static,
C: PipelineHandleChain<P> + Send + Sync + 'static,
P: RefUnwindSafe + Send + Sync + 'static,
PE: PathExtractor<Body> + Send + Sync + 'static,
QSE: QueryStringExtractor<Body> + Send + Sync + 'static,
§type Output = SingleRouteBuilder<'a, AndRouteMatcher<M, NRM>, C, P, PE, QSE>
type Output = SingleRouteBuilder<'a, AndRouteMatcher<M, NRM>, C, P, PE, QSE>
The type returned when extending the existing RouteMatcher
with the target type.
source§impl<'a, M, C, P, PE, QSE, NPE> ReplacePathExtractor<NPE> for SingleRouteBuilder<'a, M, C, P, PE, QSE>where
M: RouteMatcher + Send + Sync + 'static,
C: PipelineHandleChain<P> + Send + Sync + 'static,
P: RefUnwindSafe + Send + Sync + 'static,
PE: PathExtractor<Body> + Send + Sync + 'static,
QSE: QueryStringExtractor<Body> + Send + Sync + 'static,
NPE: PathExtractor<Body> + Send + Sync + 'static,
impl<'a, M, C, P, PE, QSE, NPE> ReplacePathExtractor<NPE> for SingleRouteBuilder<'a, M, C, P, PE, QSE>where
M: RouteMatcher + Send + Sync + 'static,
C: PipelineHandleChain<P> + Send + Sync + 'static,
P: RefUnwindSafe + Send + Sync + 'static,
PE: PathExtractor<Body> + Send + Sync + 'static,
QSE: QueryStringExtractor<Body> + Send + Sync + 'static,
NPE: PathExtractor<Body> + Send + Sync + 'static,
§type Output = SingleRouteBuilder<'a, M, C, P, NPE, QSE>
type Output = SingleRouteBuilder<'a, M, C, P, NPE, QSE>
The type returned when replacing the
PathExtractor
with the target type.source§impl<'a, M, C, P, PE, QSE, NQSE> ReplaceQueryStringExtractor<NQSE> for SingleRouteBuilder<'a, M, C, P, PE, QSE>where
M: RouteMatcher + Send + Sync + 'static,
C: PipelineHandleChain<P> + Send + Sync + 'static,
P: RefUnwindSafe + Send + Sync + 'static,
PE: PathExtractor<Body> + Send + Sync + 'static,
QSE: QueryStringExtractor<Body> + Send + Sync + 'static,
NQSE: QueryStringExtractor<Body> + Send + Sync + 'static,
impl<'a, M, C, P, PE, QSE, NQSE> ReplaceQueryStringExtractor<NQSE> for SingleRouteBuilder<'a, M, C, P, PE, QSE>where
M: RouteMatcher + Send + Sync + 'static,
C: PipelineHandleChain<P> + Send + Sync + 'static,
P: RefUnwindSafe + Send + Sync + 'static,
PE: PathExtractor<Body> + Send + Sync + 'static,
QSE: QueryStringExtractor<Body> + Send + Sync + 'static,
NQSE: QueryStringExtractor<Body> + Send + Sync + 'static,
§type Output = SingleRouteBuilder<'a, M, C, P, PE, NQSE>
type Output = SingleRouteBuilder<'a, M, C, P, PE, NQSE>
The type returned when replacing the
QueryStringExtractor
with the target type.