mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-24 00:21:08 +01:00
Add more docs to ResourceHandler API
This commit is contained in:
parent
f414a491dd
commit
d912bf8771
@ -128,6 +128,14 @@ impl<S: 'static> ResourceHandler<S> {
|
|||||||
|
|
||||||
/// Register a new route and add method check to route.
|
/// Register a new route and add method check to route.
|
||||||
///
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// # extern crate actix_web;
|
||||||
|
/// use actix_web::*;
|
||||||
|
/// fn index(req: HttpRequest) -> HttpResponse { unimplemented!() }
|
||||||
|
///
|
||||||
|
/// App::new().resource("/", |r| r.method(http::Method::GET).f(index));
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
/// This is shortcut for:
|
/// This is shortcut for:
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
@ -143,6 +151,14 @@ impl<S: 'static> ResourceHandler<S> {
|
|||||||
|
|
||||||
/// Register a new route and add handler object.
|
/// Register a new route and add handler object.
|
||||||
///
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// # extern crate actix_web;
|
||||||
|
/// use actix_web::*;
|
||||||
|
/// fn handler(req: HttpRequest) -> HttpResponse { unimplemented!() }
|
||||||
|
///
|
||||||
|
/// App::new().resource("/", |r| r.h(handler));
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
/// This is shortcut for:
|
/// This is shortcut for:
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
@ -158,6 +174,14 @@ impl<S: 'static> ResourceHandler<S> {
|
|||||||
|
|
||||||
/// Register a new route and add handler function.
|
/// Register a new route and add handler function.
|
||||||
///
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// # extern crate actix_web;
|
||||||
|
/// use actix_web::*;
|
||||||
|
/// fn index(req: HttpRequest) -> HttpResponse { unimplemented!() }
|
||||||
|
///
|
||||||
|
/// App::new().resource("/", |r| r.f(index));
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
/// This is shortcut for:
|
/// This is shortcut for:
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
@ -177,6 +201,14 @@ impl<S: 'static> ResourceHandler<S> {
|
|||||||
|
|
||||||
/// Register a new route and add handler.
|
/// Register a new route and add handler.
|
||||||
///
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// # extern crate actix_web;
|
||||||
|
/// use actix_web::*;
|
||||||
|
/// fn index(req: HttpRequest) -> HttpResponse { unimplemented!() }
|
||||||
|
///
|
||||||
|
/// App::new().resource("/", |r| r.with(index));
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
/// This is shortcut for:
|
/// This is shortcut for:
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
@ -197,6 +229,19 @@ impl<S: 'static> ResourceHandler<S> {
|
|||||||
|
|
||||||
/// Register a new route and add async handler.
|
/// Register a new route and add async handler.
|
||||||
///
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// # extern crate actix_web;
|
||||||
|
/// # extern crate futures;
|
||||||
|
/// use actix_web::*;
|
||||||
|
/// use futures::future::Future;
|
||||||
|
///
|
||||||
|
/// fn index(req: HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>> {
|
||||||
|
/// unimplemented!()
|
||||||
|
/// }
|
||||||
|
///
|
||||||
|
/// App::new().resource("/", |r| r.with_async(index));
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
/// This is shortcut for:
|
/// This is shortcut for:
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
|
Loading…
Reference in New Issue
Block a user