docs for path attribute

This commit is contained in:
realaravinth 2021-05-13 19:29:49 +05:30
parent 0b61bd6b0b
commit 314ffd71c9
No known key found for this signature in database
GPG Key ID: AD9F0F08E855ED88
2 changed files with 1 additions and 7 deletions

View File

@ -117,6 +117,7 @@ Creates route handler with `actix_web::guard::", stringify!($variant), "`.
# Attributes # Attributes
- `"path"` - Raw literal string with path for which to register handler. - `"path"` - Raw literal string with path for which to register handler.
- `path="variable_name"` - Variable name that contains path for which to register handler
- `name="resource_name"` - Specifies resource name for the handler. If not set, the function name of handler is used. - `name="resource_name"` - Specifies resource name for the handler. If not set, the function 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.

View File

@ -77,9 +77,7 @@ impl TryFrom<&syn::LitStr> for MethodType {
} }
struct Args { struct Args {
//path: Option<syn::LitStr>,
path: Box<dyn PathMarker>, path: Box<dyn PathMarker>,
// i_path: Option<syn::Ident>,
resource_name: Option<syn::LitStr>, resource_name: Option<syn::LitStr>,
guards: Vec<Ident>, guards: Vec<Ident>,
wrappers: Vec<syn::Type>, wrappers: Vec<syn::Type>,
@ -130,11 +128,6 @@ impl Args {
} }
} else if nv.path.is_ident("path") { } else if nv.path.is_ident("path") {
if let syn::Lit::Str(lit) = nv.lit { if let syn::Lit::Str(lit) = nv.lit {
// path = Some(syn::LitStr::new(
// &Ident::new(&lit.value(), Span::call_site()).to_string(),
// Span::call_site(),
// ));
match path { match path {
None => { None => {
let x = Ident::new(&lit.value(), Span::call_site()); let x = Ident::new(&lit.value(), Span::call_site());