fix doctest

This commit is contained in:
Arniu 2020-09-22 23:15:29 +08:00
parent f393ca28d8
commit 08262588e3
1 changed files with 10 additions and 8 deletions

View File

@ -9,8 +9,9 @@ mod route;
/// Creates resource handler, allowing multiple HTTP method guards. /// Creates resource handler, allowing multiple HTTP method guards.
/// ///
/// ## Syntax /// ## Syntax
/// /// ```text
/// #[route("path", method="HTTP_METHOD"[, attributes])] /// #[route("path", method="HTTP_METHOD"[, attributes])]
/// ```
/// ///
/// ### Attributes /// ### Attributes
/// - `"path"` - Raw literal string with path for which to register handler. /// - `"path"` - Raw literal string with path for which to register handler.
@ -29,8 +30,8 @@ mod route;
/// use actix_web_codegen::route; /// use actix_web_codegen::route;
/// ///
/// #[route("/", method="GET", method="HEAD")] /// #[route("/", method="GET", method="HEAD")]
/// fn async example() -> HttpResponse { /// async fn example() -> HttpResponse {
/// Ok(HttpResponse::Ok().finish()) /// HttpResponse::Ok().finish()
/// } /// }
/// ``` /// ```
#[proc_macro_attribute] #[proc_macro_attribute]
@ -54,8 +55,9 @@ concat!("
Creates route handler with `actix_web::guard::", stringify!($variant), "`. Creates route handler with `actix_web::guard::", stringify!($variant), "`.
## Syntax ## Syntax
```text
#[", stringify!($method), r#"("path"[, attributes])] #[", stringify!($method), r#"("path"[, attributes])]
```
### Attributes ### Attributes
- `"path"` - Raw literal string with path for which to register handler. - `"path"` - Raw literal string with path for which to register handler.
@ -73,8 +75,8 @@ use actix_web::HttpResponse;
use actix_web_codegen::"#, stringify!($method), "; use actix_web_codegen::"#, stringify!($method), ";
#[", stringify!($method), r#"("/")] #[", stringify!($method), r#"("/")]
fn async example() -> HttpResponse { async fn example() -> HttpResponse {
Ok(HttpResponse::Ok().finish()) HttpResponse::Ok().finish()
} }
``` ```
"#); "#);