1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 22:49:21 +02:00

Add ability to name a handler function as 'config' (#1290)

* eliminate handler naming restrictions #1277

* Update actix-web-codegen/CHANGES.md

Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
This commit is contained in:
Andrey Torsunov
2020-01-26 01:22:40 +03:00
committed by Yuki Okushi
parent 8888520d83
commit 71d11644a7
3 changed files with 13 additions and 3 deletions

View File

@ -195,15 +195,15 @@ impl Route {
pub struct #name;
impl actix_web::dev::HttpServiceFactory for #name {
fn register(self, config: &mut actix_web::dev::AppService) {
fn register(self, __config: &mut actix_web::dev::AppService) {
#ast
let resource = actix_web::Resource::new(#path)
let __resource = actix_web::Resource::new(#path)
.name(#resource_name)
.guard(actix_web::guard::#guard())
#(.guard(actix_web::guard::fn_guard(#extra_guards)))*
.#resource_type(#name);
actix_web::dev::HttpServiceFactory::register(resource, config)
actix_web::dev::HttpServiceFactory::register(__resource, __config)
}
}
};