chore: rust fmt
This commit is contained in:
parent
21366a0b1b
commit
670a2ee670
2 changed files with 34 additions and 32 deletions
60
src/lib.rs
60
src/lib.rs
|
@ -106,37 +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 function
|
/// - `name = "resource_name"`: Specifies resource name for the handler. If not set, the function
|
||||||
/// name of handler is used.
|
/// name of handler is used.
|
||||||
/// - `guard = "function_name"`: Registers function as guard using `actix_web::guard::fn_guard`.
|
/// - `guard = "function_name"`: Registers function as 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 code, e.g `my_guard` or `my_module::my_guard`.
|
/// generate code, e.g `my_guard` or `my_module::my_guard`.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
/// # use actix_web::HttpResponse;
|
/// # use actix_web::HttpResponse;
|
||||||
#[doc = concat!("# use actix_web_codegen_const_routes::", stringify!($method), ";")]
|
#[doc = concat!("# use actix_web_codegen_const_routes::", 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)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,9 @@ use actix_web::{
|
||||||
},
|
},
|
||||||
web, App, Error, HttpResponse, Responder,
|
web, App, Error, HttpResponse, Responder,
|
||||||
};
|
};
|
||||||
use actix_web_codegen_const_routes::{connect, delete, get, head, options, patch, post, put, route, trace};
|
use actix_web_codegen_const_routes::{
|
||||||
|
connect, delete, get, head, options, patch, post, put, route, trace,
|
||||||
|
};
|
||||||
use futures_core::future::LocalBoxFuture;
|
use futures_core::future::LocalBoxFuture;
|
||||||
|
|
||||||
// Make sure that we can name function as 'config'
|
// Make sure that we can name function as 'config'
|
||||||
|
|
Loading…
Reference in a new issue