What's missing?
Consider this situation:
#[get("/foo?<anApple>")]
fn foo(anApple: String) {
return;
}
The name of variables in codes have to be the same with the declaration in url. Therefore, if users are willing to create a query argument, who doesn't have a snake_case name, Rust will generate a warning.
Ideal Solution
Extended query arguments declaration to things like <anApple:an_apple>, <anApple..:an_apple>. Any other proper syntax is OK.
Why can't this be implemented outside of Rocket?
Users have to use Route::from and maually implement Handler with complex codes.
Are there workarounds usable today?
#[allow(non_snake_case)], or
#[derive(FromForm)]
struct Form {
#[field(name = "anApple")]
apple: String,
}
#[get("/foo?<form...>")]
fn foo(form: Form) {
// form.apple
return;
}
Alternative Solutions
- Providing hints in compile time to guide users to
#[allow(non_snake_case)].
- Automatically add
#[allow(non_snake_case)] to compilers.
Additional Context
No response
System Checks
What's missing?
Consider this situation:
The name of variables in codes have to be the same with the declaration in url. Therefore, if users are willing to create a query argument, who doesn't have a snake_case name, Rust will generate a warning.
Ideal Solution
Extended query arguments declaration to things like
<anApple:an_apple>,<anApple..:an_apple>. Any other proper syntax is OK.Why can't this be implemented outside of Rocket?
Users have to use
Route::fromand maually implementHandlerwith complex codes.Are there workarounds usable today?
#[allow(non_snake_case)], orAlternative Solutions
#[allow(non_snake_case)].#[allow(non_snake_case)]to compilers.Additional Context
No response
System Checks