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

Determines if this Route can be invoked, based on the Request.

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

Extracts the Request path and stores it in State

Extends the Response object when path extraction fails

Extracts the Request query string and stores it in State

Extends the Response object when query string extraction fails

Final call made by the Router to the matched Route allowing application specific logic to respond to the request.

Implementors