mirror of
https://github.com/tokio-rs/axum.git
synced 2025-10-02 15:24:54 +00:00
Implement IntoResponse
for [u8; N]
and &'static [u8; N]
(#1690)
Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
This commit is contained in:
parent
e3aaeb3cb7
commit
e4c6d76bca
@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
- None.
|
- **added** Implement IntoResponse for &'static [u8; N] and [u8; N] ([#1690])
|
||||||
|
|
||||||
|
[#1690]: https://github.com/tokio-rs/axum/pull/1690
|
||||||
|
|
||||||
# 0.3.1 (9. January, 2023)
|
# 0.3.1 (9. January, 2023)
|
||||||
|
|
||||||
|
@ -348,6 +348,18 @@ impl IntoResponse for &'static [u8] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<const N: usize> IntoResponse for &'static [u8; N] {
|
||||||
|
fn into_response(self) -> Response {
|
||||||
|
self.as_slice().into_response()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<const N: usize> IntoResponse for [u8; N] {
|
||||||
|
fn into_response(self) -> Response {
|
||||||
|
self.to_vec().into_response()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl IntoResponse for Vec<u8> {
|
impl IntoResponse for Vec<u8> {
|
||||||
fn into_response(self) -> Response {
|
fn into_response(self) -> Response {
|
||||||
Cow::<'static, [u8]>::Owned(self).into_response()
|
Cow::<'static, [u8]>::Owned(self).into_response()
|
||||||
|
@ -5,6 +5,7 @@ error[E0277]: the trait bound `bool: IntoResponse` is not satisfied
|
|||||||
| ^^^^ the trait `IntoResponse` is not implemented for `bool`
|
| ^^^^ the trait `IntoResponse` is not implemented for `bool`
|
||||||
|
|
|
|
||||||
= help: the following other types implement trait `IntoResponse`:
|
= help: the following other types implement trait `IntoResponse`:
|
||||||
|
&'static [u8; N]
|
||||||
&'static [u8]
|
&'static [u8]
|
||||||
&'static str
|
&'static str
|
||||||
()
|
()
|
||||||
@ -12,8 +13,7 @@ error[E0277]: the trait bound `bool: IntoResponse` is not satisfied
|
|||||||
(Response<()>, T1, R)
|
(Response<()>, T1, R)
|
||||||
(Response<()>, T1, T2, R)
|
(Response<()>, T1, T2, R)
|
||||||
(Response<()>, T1, T2, T3, R)
|
(Response<()>, T1, T2, T3, R)
|
||||||
(Response<()>, T1, T2, T3, T4, R)
|
and 122 others
|
||||||
and 120 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
|
||||||
|
|
|
|
||||||
|
@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
- None.
|
- - **added** Implement IntoResponse for &'static [u8; N] and [u8; N] ([#1690])
|
||||||
|
|
||||||
|
[#1690]: https://github.com/tokio-rs/axum/pull/1690
|
||||||
|
|
||||||
# 0.6.2 (9. January, 2023)
|
# 0.6.2 (9. January, 2023)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user