-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve debug_handler message for generic request-consuming extractors (
#1826) Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
- Loading branch information
1 parent
1327a59
commit a26ddd1
Showing
4 changed files
with
73 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use axum::Json; | ||
use axum_macros::debug_handler; | ||
|
||
struct Struct {} | ||
|
||
#[debug_handler] | ||
async fn handler(foo: Json<Struct>) {} | ||
|
||
fn main() {} |
20 changes: 20 additions & 0 deletions
20
axum-macros/tests/debug_handler/fail/json_not_deserialize.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
error[E0277]: the trait bound `for<'de> Struct: serde::de::Deserialize<'de>` is not satisfied | ||
--> tests/debug_handler/fail/json_not_deserialize.rs:7:23 | ||
| | ||
7 | async fn handler(foo: Json<Struct>) {} | ||
| ^^^^^^^^^^^^ the trait `for<'de> serde::de::Deserialize<'de>` is not implemented for `Struct` | ||
| | ||
= help: the following other types implement trait `serde::de::Deserialize<'de>`: | ||
&'a [u8] | ||
&'a serde_json::raw::RawValue | ||
&'a std::path::Path | ||
&'a str | ||
() | ||
(T0, T1) | ||
(T0, T1, T2) | ||
(T0, T1, T2, T3) | ||
and $N others | ||
= note: required for `Struct` to implement `serde::de::DeserializeOwned` | ||
= note: required for `Json<Struct>` to implement `FromRequest<(), Body>` | ||
= help: see issue #48214 | ||
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable |