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>,
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§
source§impl<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
.source§fn 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.source§fn delegation(&self) -> Delegation
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>>
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>
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>
)
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>
fn extract_query_string(&self, state: &mut State) -> Result<(), ExtractorFailed>
Extracts the query string parameters and stores the
QueryStringExtractor
in State
.