mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-23 00:00:15 +02:00
feat: add #[diagnostic::on_unimplemented] to IntoResponse and IntoResponseParts (#3723)
This commit is contained in:
@@ -109,6 +109,9 @@ use std::{
|
||||
/// let app = Router::new().route("/", get(|| async { MyBody }));
|
||||
/// # let _: Router = app;
|
||||
/// ```
|
||||
#[diagnostic::on_unimplemented(
|
||||
note = "See `https://docs.rs/axum/0.8/axum/response/trait.IntoResponse.html` for details"
|
||||
)]
|
||||
pub trait IntoResponse {
|
||||
/// Create a response.
|
||||
#[must_use]
|
||||
|
||||
@@ -70,6 +70,9 @@ use std::{convert::Infallible, fmt};
|
||||
/// SetHeader("x-foo", "custom")
|
||||
/// }
|
||||
/// ```
|
||||
#[diagnostic::on_unimplemented(
|
||||
note = "See `https://docs.rs/axum/0.8/axum/response/trait.IntoResponseParts.html` for details"
|
||||
)]
|
||||
pub trait IntoResponseParts {
|
||||
/// The type returned in the event of an error.
|
||||
///
|
||||
|
||||
@@ -9,6 +9,7 @@ help: the trait `IntoResponse` is not implemented for `NotIntoResponse`
|
||||
|
|
||||
3 | struct NotIntoResponse;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: See `https://docs.rs/axum/0.8/axum/response/trait.IntoResponse.html` for details
|
||||
= help: the following other types implement trait `IntoResponse`:
|
||||
&'static [u8; N]
|
||||
&'static [u8]
|
||||
|
||||
@@ -15,6 +15,7 @@ help: the trait `IntoResponseParts` is not implemented for `CustomIntoResponse`
|
||||
|
|
||||
12 | struct CustomIntoResponse {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: See `https://docs.rs/axum/0.8/axum/response/trait.IntoResponseParts.html` for details
|
||||
= help: the following other types implement trait `IntoResponseParts`:
|
||||
()
|
||||
(T1, T2)
|
||||
@@ -42,6 +43,7 @@ help: the trait `IntoResponseParts` is not implemented for `CustomIntoResponse`
|
||||
|
|
||||
12 | struct CustomIntoResponse {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: See `https://docs.rs/axum/0.8/axum/response/trait.IntoResponseParts.html` for details
|
||||
= help: the following other types implement trait `IntoResponseParts`:
|
||||
()
|
||||
(T1, T2)
|
||||
|
||||
@@ -4,6 +4,7 @@ error[E0277]: the trait bound `bool: IntoResponse` is not satisfied
|
||||
4 | async fn handler() -> bool {
|
||||
| ^^^^ the trait `IntoResponse` is not implemented for `bool`
|
||||
|
|
||||
= note: See `https://docs.rs/axum/0.8/axum/response/trait.IntoResponse.html` for details
|
||||
= help: the following other types implement trait `IntoResponse`:
|
||||
&'static [u8; N]
|
||||
&'static [u8]
|
||||
|
||||
Reference in New Issue
Block a user