Skip to content

Commit

Permalink
Implement IntoResponse for (R,) where R: IntoResponse
Browse files Browse the repository at this point in the history
I just happened to notice we were missing this impl. Probably isn't the
most useful thing but still nice to have for consistency and maybe some
cursed macro stuff.
  • Loading branch information
davidpdrsn committed Aug 2, 2023
1 parent 2138489 commit 279fbdd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions axum-core/src/response/into_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,16 @@ where
}
}

impl<R> IntoResponse for (R,)
where
R: IntoResponse,
{
fn into_response(self) -> Response {
let (res,) = self;
res.into_response()
}
}

macro_rules! impl_into_response {
( $($ty:ident),* $(,)? ) => {
#[allow(non_snake_case)]
Expand Down
1 change: 1 addition & 0 deletions axum/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **change:** Update tokio-tungstenite to 0.19 ([#2021])
- **change:** axum's MSRV is now 1.63 ([#2021])
- **added:** Implement `Handler` for `T: IntoResponse` ([#2140])
- **added:** Implement `IntoResponse` for `(R,) where R: IntoResponse`

[#2021]: https://github.com/tokio-rs/axum/pull/2021
[#2014]: https://github.com/tokio-rs/axum/pull/2014
Expand Down

0 comments on commit 279fbdd

Please sign in to comment.