-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
export handler::Handler #1339
export handler::Handler #1339
Conversation
I want to implement a custom Factory to strictly define arguments for handlers
I think You can use |
@cetra3 Can you show me example with |
@sergeysova see my PR. |
@JohnTitor what do you think? I tries to implement actix-swagger(cargo-swagg) code generator. I need a factory with required arguments. |
I agree with this sentiment I believe this can already be done |
Can you show me an example, I want to define Factory with required arguments and types and some optional rest. For example: fn my_handler(body: web::Json<Type>, another: Another) {}
fn handler2(body: web::Json<Type>, app: web::Data<App>) {}
fn handler3(body: web::Json<Type>) {}
fn handler_wr(body: web::Json<Another>) {} I want to have some method, that receives any function that have first argument of specified type, and rest arguments just impl FromRequst. // ok
bind_handler(my_handler);
bind_handler(handler2);
bind_handler(handler3);
// fail
bind_handler(handler_wr); |
@sergeysova is this still something you need access to? |
@robjtede yes. It should be useful |
Codecov Report
@@ Coverage Diff @@
## master #1339 +/- ##
==========================================
- Coverage 53.49% 53.48% -0.02%
==========================================
Files 128 131 +3
Lines 11979 11982 +3
==========================================
Hits 6408 6408
- Misses 5571 5574 +3
Continue to review full report at Codecov.
|
@sergeysova Ok, what's the reason that the exposed |
I want to implement a custom Factory to strictly define arguments for handlers