pub struct RouterBuilder { /* private fields */ }Expand description
Builder for a router
Example usage:
Implementations§
Source§impl RouterBuilder
impl RouterBuilder
pub fn new() -> RouterBuilder
Sourcepub fn add(self, route: Route) -> RouterBuilder
pub fn add(self, route: Route) -> RouterBuilder
Adds new Route for Router that is being built.
Example:
ⓘ
use hyper::server::{Request, Response};
use hyper_router::{Route, RouterBuilder};
fn some_handler(_: Request) -> Response {
// do something
}
RouterBuilder::new().add(Route::get(r"/person/\d+").using(some_handler));pub fn build(self) -> Router
Trait Implementations§
Source§impl Debug for RouterBuilder
impl Debug for RouterBuilder
Source§impl Default for RouterBuilder
impl Default for RouterBuilder
Source§fn default() -> RouterBuilder
fn default() -> RouterBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RouterBuilder
impl !RefUnwindSafe for RouterBuilder
impl Send for RouterBuilder
impl Sync for RouterBuilder
impl Unpin for RouterBuilder
impl UnwindSafe for RouterBuilder
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