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
sourceimpl<'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,
sourcefn 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 more
sourcefn 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,
Similar to to
, but accepts an async fn
Read more
sourcefn 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,
Directs the route to the given async fn
, passing State
to it by mutable reference. Read more
sourcefn 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 more
sourcefn with_path_extractor<NPE>(self) -> <Self as ReplacePathExtractor<NPE>>::Output where
NPE: PathExtractor<Body> + Send + Sync + 'static,
fn with_path_extractor<NPE>(self) -> <Self as ReplacePathExtractor<NPE>>::Output where
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 more
sourcefn with_query_string_extractor<NQSE>(
self
) -> <Self as ReplaceQueryStringExtractor<NQSE>>::Output where
NQSE: QueryStringExtractor<Body> + Send + Sync + 'static,
fn with_query_string_extractor<NQSE>(
self
) -> <Self as ReplaceQueryStringExtractor<NQSE>>::Output where
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 more
sourcefn add_route_matcher<NRM>(
self,
matcher: NRM
) -> <Self as ExtendRouteMatcher<NRM>>::Output where
NRM: RouteMatcher + Send + Sync + 'static,
fn add_route_matcher<NRM>(
self,
matcher: NRM
) -> <Self as ExtendRouteMatcher<NRM>>::Output where
NRM: RouteMatcher + Send + Sync + 'static,
Adds additional RouteMatcher
requirements to the current route. Read more
sourcefn to_dir<P>(self, options: P) where
Self: ReplacePathExtractor<FilePathExtractor> + Sized,
Self::Output: DefineSingleRoute,
FileOptions: From<P>,
fn to_dir<P>(self, options: P) where
Self: ReplacePathExtractor<FilePathExtractor> + Sized,
Self::Output: DefineSingleRoute,
FileOptions: From<P>,
Directs the route to serve static files from the given root directory. The route must contain a trailing glob segment, which will be used to serve any matching names under the given path. Read more
sourceimpl<'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.
sourceimpl<'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.
sourceimpl<'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.
Auto Trait Implementations
impl<'a, M, C, P, PE, QSE> RefUnwindSafe for SingleRouteBuilder<'a, M, C, P, PE, QSE> where
P: RefUnwindSafe,
impl<'a, M, C, P, PE, QSE> Send for SingleRouteBuilder<'a, M, C, P, PE, QSE>
impl<'a, M, C, P, PE, QSE> Sync for SingleRouteBuilder<'a, M, C, P, PE, QSE>
impl<'a, M, C, P, PE, QSE> Unpin for SingleRouteBuilder<'a, M, C, P, PE, QSE> where
C: Unpin,
M: Unpin,
PE: Unpin,
QSE: Unpin,
impl<'a, M, C, P, PE, QSE> !UnwindSafe for SingleRouteBuilder<'a, M, C, P, PE, QSE>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more