pub struct Route { /* private fields */ }
Expand description
A collection of verb-handler pair.
Implementations§
source§impl Route
impl Route
sourcepub fn push(
self,
method: Method,
handler: Box<dyn Handler<Request<Body>, Output = Result<Response<Body>, Error>> + 'static, Global>
) -> Route
pub fn push(
self,
method: Method,
handler: Box<dyn Handler<Request<Body>, Output = Result<Response<Body>, Error>> + 'static, Global>
) -> Route
Appends a HTTP verb and handler pair into the route.
sourcepub fn on<H, O>(self, method: Method, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
pub fn on<H, O>(self, method: Method, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
Appends a handler by the specified HTTP verb into the route.
sourcepub fn any<H, O>(self, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
pub fn any<H, O>(self, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
Appends a handler by any HTTP verbs into the route.
sourcepub fn get<H, O>(self, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
pub fn get<H, O>(self, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
Appends a handler buy the HTTP GET
verb into the route.
sourcepub fn post<H, O>(self, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
pub fn post<H, O>(self, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
Appends a handler buy the HTTP POST
verb into the route.
sourcepub fn put<H, O>(self, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
pub fn put<H, O>(self, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
Appends a handler buy the HTTP PUT
verb into the route.
sourcepub fn delete<H, O>(self, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
pub fn delete<H, O>(self, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
Appends a handler buy the HTTP DELETE
verb into the route.
sourcepub fn head<H, O>(self, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
pub fn head<H, O>(self, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
Appends a handler buy the HTTP HEAD
verb into the route.
sourcepub fn options<H, O>(self, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
pub fn options<H, O>(self, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
Appends a handler buy the HTTP OPTIONS
verb into the route.
sourcepub fn connect<H, O>(self, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
pub fn connect<H, O>(self, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
Appends a handler buy the HTTP CONNECT
verb into the route.
sourcepub fn patch<H, O>(self, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
pub fn patch<H, O>(self, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
Appends a handler buy the HTTP PATCH
verb into the route.
sourcepub fn trace<H, O>(self, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
pub fn trace<H, O>(self, handler: H) -> Routewhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
Appends a handler buy the HTTP TRACE
verb into the route.
sourcepub fn map_handler<F>(self, f: F) -> Routewhere
F: Fn(Box<dyn Handler<Request<Body>, Output = Result<Response<Body>, Error>> + 'static, Global>) -> Box<dyn Handler<Request<Body>, Output = Result<Response<Body>, Error>> + 'static, Global>,
pub fn map_handler<F>(self, f: F) -> Routewhere
F: Fn(Box<dyn Handler<Request<Body>, Output = Result<Response<Body>, Error>> + 'static, Global>) -> Box<dyn Handler<Request<Body>, Output = Result<Response<Body>, Error>> + 'static, Global>,
Takes a closure and creates an iterator which calls that closure on each handler.
sourcepub fn with<T>(self, t: T) -> Routewhere
T: Transform<Box<dyn Handler<Request<Body>, Output = Result<Response<Body>, Error>> + 'static, Global>>,
<T as Transform<Box<dyn Handler<Request<Body>, Output = Result<Response<Body>, Error>> + 'static, Global>>>::Output: Handler<Request<Body>, Output = Result<Response<Body>, Error>>,
pub fn with<T>(self, t: T) -> Routewhere
T: Transform<Box<dyn Handler<Request<Body>, Output = Result<Response<Body>, Error>> + 'static, Global>>,
<T as Transform<Box<dyn Handler<Request<Body>, Output = Result<Response<Body>, Error>> + 'static, Global>>>::Output: Handler<Request<Body>, Output = Result<Response<Body>, Error>>,
Transforms the types to a middleware and adds it.