pub struct Router { /* private fields */ }
Expand description
This is the one. The router.
Implementations§
Source§impl Router
impl Router
Sourcepub fn find_handler_with_defaults(&self, request: &Request<Body>) -> Handler
pub fn find_handler_with_defaults(&self, request: &Request<Body>) -> Handler
Finds handler for given Hyper 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.
Sourcepub fn find_handler(&self, request: &Request<Body>) -> HttpResult<Handler>
pub fn find_handler(&self, request: &Request<Body>) -> HttpResult<Handler>
Finds handler for given Hyper request.
It returns handler if it’s found or StatusCode
for error.
This method may return NotFound
, MethodNotAllowed
or NotImplemented
status codes.
Sourcepub fn find_matching_routes(&self, request_path: &str) -> Vec<&Route>
pub fn find_matching_routes(&self, request_path: &str) -> Vec<&Route>
Returns vector of Route
s that match to given path.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Router
impl !RefUnwindSafe for Router
impl Send for Router
impl Sync for Router
impl Unpin for Router
impl UnwindSafe for Router
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more