1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-11-26 03:21:08 +00:00

fmt codegen

This commit is contained in:
Rob Ede 2022-01-20 01:54:57 +00:00
parent f227e880d7
commit c959916346
No known key found for this signature in database
GPG key ID: 97C636207D3EF933

View file

@ -106,38 +106,37 @@ pub fn route(args: TokenStream, input: TokenStream) -> TokenStream {
macro_rules! method_macro { macro_rules! method_macro {
($variant:ident, $method:ident) => { ($variant:ident, $method:ident) => {
#[doc = concat!("Creates route handler with `actix_web::guard::", stringify!($variant), "`.")] #[doc = concat!("Creates route handler with `actix_web::guard::", stringify!($variant), "`.")]
/// ///
/// # Syntax /// # Syntax
/// ```plain /// ```plain
#[doc = concat!("#[", stringify!($method), r#"("path"[, attributes])]"#)] #[doc = concat!("#[", 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.
/// - `name = "resource_name"`: Specifies resource name for the handler. If not set, the /// - `name = "resource_name"`: Specifies resource name for the handler. If not set, the function
/// function name of handler is used. /// name of handler is used.
/// - `guard = "function_name"`: Registers function as guard. /// - `guard = "function_name"`: Registers function as guard using `actix_web::guard::fn_guard`.
/// using `actix_web::guard::fn_guard`. /// - `wrap = "Middleware"`: Registers a resource middleware.
/// - `wrap = "Middleware"`: Registers a resource middleware. ///
/// /// # Notes
/// # Notes /// Function name can be specified as any expression that is going to be accessible to the
/// Function name can be specified as any expression that is going to be accessible to the generate /// generate code, e.g `my_guard` or `my_module::my_guard`.
/// code, e.g `my_guard` or `my_module::my_guard`. ///
/// /// # Example
/// # Example /// ```
/// ``` /// # use actix_web::HttpResponse;
/// # use actix_web::HttpResponse; #[doc = concat!("# use actix_web_codegen::", stringify!($method), ";")]
#[doc = concat!("# use actix_web_codegen::", stringify!($method), ";")] #[doc = concat!("#[", stringify!($method), r#"("/")]"#)]
#[doc = concat!("#[", stringify!($method), r#"("/")]"#)] /// async fn example() -> HttpResponse {
/// async fn example() -> HttpResponse { /// HttpResponse::Ok().finish()
/// HttpResponse::Ok().finish() /// }
/// } /// ```
/// ``` #[proc_macro_attribute]
#[proc_macro_attribute] pub fn $method(args: TokenStream, input: TokenStream) -> TokenStream {
pub fn $method(args: TokenStream, input: TokenStream) -> TokenStream {
route::with_method(Some(route::MethodType::$variant), args, input) route::with_method(Some(route::MethodType::$variant), args, input)
} }
}; };
} }