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,

source§

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
source§

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
source§

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
source§

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
source§

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
source§

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
source§

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
source§

fn to_file<P>(self, options: P)
where Self: Sized, FileOptions: From<P>,

Directs the route to serve a single static file from the given path. Read more
source§

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>

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,

§

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,

§

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> Freeze for SingleRouteBuilder<'a, M, C, P, PE, QSE>
where M: Freeze, C: Freeze,

§

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 M: Unpin, C: Unpin, PE: Unpin, QSE: Unpin,

§

impl<'a, M, C, P, PE, QSE> !UnwindSafe for SingleRouteBuilder<'a, M, C, P, PE, QSE>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more