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
sourceimpl<RM, PE, QSE> RouteImpl<RM, PE, QSE> where
RM: RouteMatcher,
PE: PathExtractor<Body>,
QSE: QueryStringExtractor<Body>,
impl<RM, PE, QSE> RouteImpl<RM, PE, QSE> where
RM: RouteMatcher,
PE: PathExtractor<Body>,
QSE: QueryStringExtractor<Body>,
sourcepub fn new(
matcher: RM,
dispatcher: Box<dyn Dispatcher + Send + Sync>,
_extractors: Extractors<PE, QSE>,
delegation: Delegation
) -> Self
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
sourceimpl<RM, PE, QSE> Route for RouteImpl<RM, PE, QSE> where
RM: RouteMatcher,
PE: PathExtractor<Body>,
QSE: QueryStringExtractor<Body>,
impl<RM, PE, QSE> Route for RouteImpl<RM, PE, QSE> where
RM: RouteMatcher,
PE: PathExtractor<Body>,
QSE: QueryStringExtractor<Body>,
type ResBody = 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
. Read more
sourcefn is_match(&self, state: &State) -> Result<(), RouteNonMatch>
fn is_match(&self, state: &State) -> Result<(), RouteNonMatch>
Determines if this Route
should be invoked, based on the request data in `State.
sourcefn delegation(&self) -> Delegation
fn delegation(&self) -> Delegation
Determines if this Route
intends to delegate requests to a secondary Router
instance.
sourcefn dispatch(&self, state: State) -> Pin<Box<HandlerFuture>>
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. Read more
sourcefn extract_request_path<'a>(
&self,
state: &mut State,
params: SegmentMapping<'a>
) -> Result<(), ExtractorFailed>
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
.
sourcefn extend_response_on_path_error(
&self,
state: &mut State,
res: &mut Response<Self::ResBody>
)
fn extend_response_on_path_error(
&self,
state: &mut State,
res: &mut Response<Self::ResBody>
)
Extends the Response
object when the PathExtractor
fails.
sourcefn extract_query_string(&self, state: &mut State) -> Result<(), ExtractorFailed>
fn extract_query_string(&self, state: &mut State) -> Result<(), ExtractorFailed>
Extracts the query string parameters and stores the QueryStringExtractor
in State
.
sourcefn extend_response_on_query_string_error(
&self,
state: &mut State,
res: &mut Response<Self::ResBody>
)
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
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