Struct canteen::route::Route
[−]
[src]
pub struct Route { pub handler: fn(_: &Request) -> Response, // some fields omitted }
This struct defines a route or endpoint.
Fields
handler: fn(_: &Request) -> Response
Methods
impl Route
[src]
fn new(
path: &str,
method: Method,
handler: fn(_: &Request) -> Response
) -> Route
[src]
path: &str,
method: Method,
handler: fn(_: &Request) -> Response
) -> Route
Create a new Route. This function is called by the Canteen struct.
fn is_match(&self, req: &Request) -> bool
[src]
Check if this Route matches a given URI.
fn parse(&self, path: &str) -> HashMap<String, String>
[src]
Parse and extract the variables from a URI based on this Route's definition.