Struct tokio_http2::router::Router
[−]
[src]
pub struct Router { pub routes: Vec<Route>, }
This is the one. The router.
Fields
routes: Vec<Route>
Methods
impl Router
[src]
fn new() -> Router
Create a default Router.
Returns a newly created Router.
fn find_handler_with_defaults(&self, request: &Request) -> Handler
Finds handler for given Request.
This method uses default error handlers. If the request does not match any route than default 404 handler is returned. If the request match some routes but http method does not match (used GET but routes are defined for POST) than default method not supported handler is returned.
fn find_handler(&self, request: &Request) -> Option<Handler>
Finds handler for given Request.
It returns handler if it's found or StatusCode
for error.
This method may return NotFound
, MethodNotAllowed
or NotImplemented
status codes.
fn find_handler_with_method_and_path(&self,
method: Method,
request_path: &str)
-> Option<Handler>
method: Method,
request_path: &str)
-> Option<Handler>
Finds handler for given &str path.
It returns handler if it's found or StatusCode
for error.
This method may return NotFound
, MethodNotAllowed
or NotImplemented
status codes.
fn find_for_method(&self,
routes: &Vec<&Route>,
method: &Method)
-> Option<Handler>
routes: &Vec<&Route>,
method: &Method)
-> Option<Handler>
Trait Implementations
impl Debug for Router
[src]
impl Clone for Router
[src]
fn clone(&self) -> Router
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more