From 25e3867b1d4190ca582e7b1c5d23aafea955b599 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Tue, 23 Nov 2021 16:11:49 +0000 Subject: [PATCH] rename boxbody from_body to new --- actix-http/CHANGES.md | 4 +++- actix-http/src/body/body.rs | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/actix-http/CHANGES.md b/actix-http/CHANGES.md index 1eaccfb2e..d9164c54e 100644 --- a/actix-http/CHANGES.md +++ b/actix-http/CHANGES.md @@ -3,9 +3,11 @@ ## Unreleased - 2021-xx-xx ### Added * Add timeout for canceling HTTP/2 server side connection handshake. Default to 5 seconds. [#2483] -* HTTP/2 handshake timeout can be configured with `ServiceConfig::client_timeout`. [#2483] +* HTTP/2 handshake timeout can be configured with `ServiceConfig::client_timeout`. [#2483] +* Rename `body::BoxBody::{from_body => new}`. [#????] [#2483]: https://github.com/actix/actix-web/pull/2483 +[#????]: https://github.com/actix/actix-web/pull/???? ## 3.0.0-beta.14 - 2021-11-30 ### Changed diff --git a/actix-http/src/body/body.rs b/actix-http/src/body/body.rs index e8861024b..50230c2eb 100644 --- a/actix-http/src/body/body.rs +++ b/actix-http/src/body/body.rs @@ -14,6 +14,7 @@ use crate::error::Error; use super::{BodySize, BodyStream, MessageBody, MessageBodyMapErr, SizedStream}; +/// (Deprecated) Represents various types of HTTP message body. #[deprecated(since = "4.0.0", note = "Renamed to `AnyBody`.")] pub type Body = AnyBody; @@ -48,7 +49,7 @@ impl AnyBody { B: MessageBody + 'static, B::Error: Into>, { - Self::Body(BoxBody::from_body(body)) + Self::Body(BoxBody::new(body)) } /// Constructs new `AnyBody` instance from a slice of bytes by copying it. @@ -242,7 +243,7 @@ pub struct BoxBody(Pin>>>); impl BoxBody { /// Boxes a `MessageBody` and any errors it generates. - pub fn from_body(body: B) -> Self + pub fn new(body: B) -> Self where B: MessageBody + 'static, B::Error: Into>, @@ -323,7 +324,7 @@ mod tests { #[actix_rt::test] async fn nested_boxed_body() { let body = AnyBody::copy_from_slice(&[1, 2, 3]); - let boxed_body = BoxBody::from_body(BoxBody::from_body(body)); + let boxed_body = BoxBody::new(BoxBody::new(body)); assert_eq!( to_bytes(boxed_body).await.unwrap(),