impl IntoResponseParts for () (#2471)

This commit is contained in:
David Pedersen 2023-12-30 18:47:22 +01:00 committed by GitHub
parent 7ea7e9f618
commit 85573e0573
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 2 deletions

View file

@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
# Unreleased # Unreleased
- None. - **added:** Implement `IntoResponseParts` for `()` ([#2471])
[#2471]: https://github.com/tokio-rs/axum/pull/2471
# 0.4.2 (29. December, 2023) # 0.4.2 (29. December, 2023)

View file

@ -258,3 +258,11 @@ impl IntoResponseParts for Extensions {
Ok(res) Ok(res)
} }
} }
impl IntoResponseParts for () {
type Error = Infallible;
fn into_response_parts(self, res: ResponseParts) -> Result<ResponseParts, Self::Error> {
Ok(res)
}
}

View file

@ -12,7 +12,7 @@ error[E0277]: the trait bound `bool: IntoResponse` is not satisfied
axum::extract::rejection::FailedToBufferBody axum::extract::rejection::FailedToBufferBody
axum::extract::rejection::LengthLimitError axum::extract::rejection::LengthLimitError
axum::extract::rejection::UnknownBodyError axum::extract::rejection::UnknownBodyError
axum::extract::rejection::InvalidUtf8 bytes::bytes_mut::BytesMut
and $N others and $N others
note: required by a bound in `__axum_macros_check_handler_into_response::{closure#0}::check` note: required by a bound in `__axum_macros_check_handler_into_response::{closure#0}::check`
--> tests/debug_handler/fail/wrong_return_type.rs:4:23 --> tests/debug_handler/fail/wrong_return_type.rs:4:23