Struct gotham::router::route::RouteImpl

source ·
pub struct RouteImpl<RM, PE, QSE>where
    RM: RouteMatcher,
    PE: PathExtractor<Body>,
    QSE: QueryStringExtractor<Body>,{ /* private fields */ }
Expand description

Concrete type for a route in a Gotham web application. Values of this type are created by the gotham::router::builder API and held internally in the Router for dispatching requests.

Implementations§

source§

impl<RM, PE, QSE> RouteImpl<RM, PE, QSE>where RM: RouteMatcher, PE: PathExtractor<Body>, QSE: QueryStringExtractor<Body>,

source

pub fn new( matcher: RM, dispatcher: Box<dyn Dispatcher + Send + Sync>, _extractors: Extractors<PE, QSE>, delegation: Delegation ) -> Self

Creates a new RouteImpl from the provided components.

Trait Implementations§

source§

impl<RM, PE, QSE> Route for RouteImpl<RM, PE, QSE>where RM: RouteMatcher, PE: PathExtractor<Body>, QSE: QueryStringExtractor<Body>,

§

type ResBody = Body

The type of the response body. The requirements of Hyper are that this implements HttpBody. Almost always, it will want to be hyper::Body.
source§

fn is_match(&self, state: &State) -> Result<(), RouteNonMatch>

Determines if this Route should be invoked, based on the request data in `State.
source§

fn delegation(&self) -> Delegation

Determines if this Route intends to delegate requests to a secondary Router instance.
source§

fn dispatch(&self, state: State) -> Pin<Box<HandlerFuture>>

Dispatches the request to this Route, which will execute the pipelines and the handler assigned to the `Route.
source§

fn extract_request_path<'a>( &self, state: &mut State, params: SegmentMapping<'a> ) -> Result<(), ExtractorFailed>

Extracts dynamic components of the Request path and stores the PathExtractor in State.
source§

fn extend_response_on_path_error( &self, state: &mut State, res: &mut Response<Self::ResBody> )

Extends the Response object when the PathExtractor fails.
source§

fn extract_query_string(&self, state: &mut State) -> Result<(), ExtractorFailed>

Extracts the query string parameters and stores the QueryStringExtractor in State.
source§

fn extend_response_on_query_string_error( &self, state: &mut State, res: &mut Response<Self::ResBody> )

Extends the Response object when query string extraction fails.

Auto Trait Implementations§

§

impl<RM, PE, QSE> RefUnwindSafe for RouteImpl<RM, PE, QSE>

§

impl<RM, PE, QSE> Send for RouteImpl<RM, PE, QSE>where RM: Send,

§

impl<RM, PE, QSE> Sync for RouteImpl<RM, PE, QSE>where PE: Sync, QSE: Sync, RM: Sync,

§

impl<RM, PE, QSE> Unpin for RouteImpl<RM, PE, QSE>where PE: Unpin, QSE: Unpin, RM: Unpin,

§

impl<RM, PE, QSE> !UnwindSafe for RouteImpl<RM, PE, QSE>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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<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