Trait gotham::router::route::Route
[−]
[src]
pub trait Route { fn is_match(&self, state: &State, req: &Request) -> Result<(), StatusCode>; fn delegation(&self) -> Delegation; fn extract_request_path(
&self,
state: &mut State,
segment_mapping: SegmentMapping
) -> Result<(), String>; fn extend_response_on_path_error(
&self,
state: &mut State,
res: &mut Response
); fn extract_query_string(
&self,
state: &mut State,
query: Option<&str>
) -> Result<(), String>; fn extend_response_on_query_string_error(
&self,
state: &mut State,
res: &mut Response
); fn dispatch(&self, state: State, req: Request) -> Box<HandlerFuture>; }
A type that determines if its associated logic can be exposed by the Router
in response to an external request. If it determines that it can the Route
runs extractors on
the Request
, potentially extending State
before dispatching to the Dispatcher
assigned
to this Route
.
Capable of delegating requests to secondary Router
instances in order to support "Modular
Applications".
Required Methods
fn is_match(&self, state: &State, req: &Request) -> Result<(), StatusCode>
Determines if this Route
can be invoked, based on the Request
.
fn delegation(&self) -> Delegation
Determines if this Route
intends to delegate requests to a secondary Router
instance.
fn extract_request_path(
&self,
state: &mut State,
segment_mapping: SegmentMapping
) -> Result<(), String>
&self,
state: &mut State,
segment_mapping: SegmentMapping
) -> Result<(), String>
Extracts the Request
path and stores it in State
fn extend_response_on_path_error(&self, state: &mut State, res: &mut Response)
Extends the Response
object when path extraction fails
fn extract_query_string(
&self,
state: &mut State,
query: Option<&str>
) -> Result<(), String>
&self,
state: &mut State,
query: Option<&str>
) -> Result<(), String>
Extracts the Request
query string and stores it in State
fn extend_response_on_query_string_error(
&self,
state: &mut State,
res: &mut Response
)
&self,
state: &mut State,
res: &mut Response
)
Extends the Response
object when query string extraction fails
fn dispatch(&self, state: State, req: Request) -> Box<HandlerFuture>
Final call made by the Router
to the matched Route
allowing
application specific logic to respond to the request.
Implementors
impl<RM, RE, QSE> Route for RouteImpl<RM, RE, QSE> where
RM: RouteMatcher,
RE: PathExtractor,
QSE: QueryStringExtractor,