Struct luminal_router::Router
[−]
[src]
pub struct Router {
pub routes: HashMap<Method, RouteTree<Route>>,
}Router for Hyper.
Fields
routes: HashMap<Method, RouteTree<Route>>
Methods
impl Router[src]
pub fn new() -> Self[src]
pub fn get_svc<S: Service<Request = Request, Response = Response, Error = Error, Future = ServiceFuture> + 'static>(
self,
route: &str,
service: S
) -> Result<Self, Error>[src]
self,
route: &str,
service: S
) -> Result<Self, Error>
Add a service for Method::Get at the specified route.
pub fn get<I>(self, route: &str, source: I) -> Result<Self, Error> where
I: Send + Sync + 'static + IntoService, [src]
I: Send + Sync + 'static + IntoService,
Add a Service for Method::Get at the specific route by coercing I into a Service.
pub fn post_svc<S: Service<Request = Request, Response = Response, Error = Error, Future = ServiceFuture> + 'static>(
self,
route: &str,
service: S
) -> Result<Self, Error>[src]
self,
route: &str,
service: S
) -> Result<Self, Error>
Add a handler for Method::Post at the specified route.
pub fn add<S: Service<Request = Request, Response = Response, Error = Error, Future = ServiceFuture> + 'static>(
self,
method: Method,
route: &str,
service: S
) -> Result<Self, Error>[src]
self,
method: Method,
route: &str,
service: S
) -> 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<Route>>[src]
&'a self,
method: &Method,
route_path: &str
) -> Option<&'a Option<Route>>
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.