pub struct Resources { /* private fields */ }
Expand description
A resourceful route provides a mapping between HTTP verbs and URLs to handlers.
Implementations§
source§impl Resources
impl Resources
sourcepub fn route<S>(self, path: S, route: Route) -> Resourceswhere
S: AsRef<str>,
pub fn route<S>(self, path: S, route: Route) -> Resourceswhere
S: AsRef<str>,
Inserts a path-route pair into the resources.
sourcepub fn index<H, O>(self, handler: H) -> Resourceswhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
pub fn index<H, O>(self, handler: H) -> Resourceswhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
Displays a list of the resources.
sourcepub fn new<H, O>(self, handler: H) -> Resourceswhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
pub fn new<H, O>(self, handler: H) -> Resourceswhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
Returens an HTML form for creating the resources.
sourcepub fn create<H, O>(self, handler: H) -> Resourceswhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
pub fn create<H, O>(self, handler: H) -> Resourceswhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
Creates the resources.
sourcepub fn show<H, O>(self, handler: H) -> Resourceswhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
pub fn show<H, O>(self, handler: H) -> Resourceswhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
Displays the resources.
sourcepub fn edit<H, O>(self, handler: H) -> Resourceswhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
pub fn edit<H, O>(self, handler: H) -> Resourceswhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
Returens an HTML form for editing the resources.
sourcepub fn update<H, O>(self, handler: H) -> Resourceswhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
pub fn update<H, O>(self, handler: H) -> Resourceswhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
Updates the resources, by default the PUT
verb.
sourcepub fn update_with_patch<H, O>(self, handler: H) -> Resourceswhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
pub fn update_with_patch<H, O>(self, handler: H) -> Resourceswhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
Updates the resources, by the PATCH
verb.
sourcepub fn destroy<H, O>(self, handler: H) -> Resourceswhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
pub fn destroy<H, O>(self, handler: H) -> Resourceswhere
H: Handler<Request<Body>, Output = Result<O, Error>> + Clone,
O: 'static + IntoResponse + Send + Sync,
Deletes the resources.
sourcepub fn map_handler<F>(self, f: F) -> Resourceswhere
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) -> Resourceswhere
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) -> Resourceswhere
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) -> Resourceswhere
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.