Implement IntoResponse for boxed slices (#2035)

This commit is contained in:
Alexander van Ratingen
2023-07-17 09:38:08 +02:00
committed by David Pedersen
parent dadb14689a
commit 03da6db167
2 changed files with 13 additions and 0 deletions
+12
View File
@@ -241,6 +241,12 @@ impl IntoResponse for String {
}
}
impl IntoResponse for Box<str> {
fn into_response(self) -> Response {
String::from(self).into_response()
}
}
impl IntoResponse for Cow<'static, str> {
fn into_response(self) -> Response {
let mut res = Full::from(self).into_response();
@@ -366,6 +372,12 @@ impl IntoResponse for Vec<u8> {
}
}
impl IntoResponse for Box<[u8]> {
fn into_response(self) -> Response {
Vec::from(self).into_response()
}
}
impl IntoResponse for Cow<'static, [u8]> {
fn into_response(self) -> Response {
let mut res = Full::from(self).into_response();
+1
View File
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
# 0.6.18 (30. April, 2023)
- **fixed:** Don't remove the `Sec-WebSocket-Key` header in `WebSocketUpgrade` ([#1972])
- **added:** Implement `IntoResponse` for `Box<str>` and `Box<[u8]>` ([#2035])
[#1972]: https://github.com/tokio-rs/axum/pull/1972