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 moresourcefn 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 moresourcefn 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 Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more