Struct luminal_router::Router
[−]
[src]
pub struct Router { pub routes: HashMap<Method, RouteTree<Box<Service<Request = Request, Response = Response, Error = Error, Future = ServiceFuture>>>>, }
Router for Hyper.
Fields
routes: HashMap<Method, RouteTree<Box<Service<Request = Request, Response = Response, Error = Error, Future = ServiceFuture>>>>
Methods
impl Router
[src]
pub fn new() -> Self
[src]
pub fn get<H: Service<Request = Request, Response = Response, Error = Error, Future = ServiceFuture> + 'static>(
self,
route: &str,
handler: H
) -> Result<Self, Error>
[src]
self,
route: &str,
handler: H
) -> Result<Self, Error>
Add a handler for Method::Get
at the specified route.
pub fn post<H: Service<Request = Request, Response = Response, Error = Error, Future = ServiceFuture> + 'static>(
self,
route: &str,
handler: H
) -> Result<Self, Error>
[src]
self,
route: &str,
handler: H
) -> Result<Self, Error>
Add a handler for Method::Post
at the specified route.
pub fn add<H: Service<Request = Request, Response = Response, Error = Error, Future = ServiceFuture> + 'static>(
self,
method: Method,
route: &str,
handler: H
) -> Result<Self, Error>
[src]
self,
method: Method,
route: &str,
handler: H
) -> Result<Self, Error>
Add a handler at the specific route path for the given Method
.
pub fn dispatch<'a>(
&'a self,
method: &Method,
route_path: &str
) -> Option<&'a Option<Box<Service<Request = Request, Response = Response, Error = Error, Future = ServiceFuture>>>>
[src]
&'a self,
method: &Method,
route_path: &str
) -> Option<&'a Option<Box<Service<Request = Request, Response = Response, Error = Error, Future = ServiceFuture>>>>
Trait Implementations
impl Default for Router
[src]
impl Service for Router
[src]
type Request = Request
Requests handled by the service.
type Response = Response
Responses given by the service.
type Error = Error
Errors produced by the service.
type Future = ServiceFuture
The future response value.
fn call(&self, req: Request) -> Self::Future
[src]
Process the request and return the response asynchronously.