From c912ec7f8111973460b88c7fa5753ae4480d8545 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Tue, 16 Nov 2021 00:33:10 +0000 Subject: [PATCH] rename `AnyBody::{Message => Stream}` --- actix-http/CHANGES.md | 4 ++++ actix-http/src/body/body.rs | 12 ++++++------ actix-http/src/encoding/encoder.rs | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/actix-http/CHANGES.md b/actix-http/CHANGES.md index 9ec75b4bc..fb71939b0 100644 --- a/actix-http/CHANGES.md +++ b/actix-http/CHANGES.md @@ -1,6 +1,10 @@ # Changes ## Unreleased - 2021-xx-xx +### Changed +* Rename `AnyBody::{Message => Stream}`. [#????] + +[#????]: https://github.com/actix/actix-web/pull/???? ## 3.0.0-beta.12 - 2021-11-15 diff --git a/actix-http/src/body/body.rs b/actix-http/src/body/body.rs index cd3e4c5c4..2476dff4c 100644 --- a/actix-http/src/body/body.rs +++ b/actix-http/src/body/body.rs @@ -27,7 +27,7 @@ pub enum AnyBody { Bytes(Bytes), /// Generic message body. - Message(BoxAnyBody), + Stream(BoxAnyBody), } impl AnyBody { @@ -42,7 +42,7 @@ impl AnyBody { B: MessageBody + 'static, B::Error: Into>, { - Self::Message(BoxAnyBody::from_body(body)) + Self::Stream(BoxAnyBody::from_body(body)) } } @@ -54,7 +54,7 @@ impl MessageBody for AnyBody { AnyBody::None => BodySize::None, AnyBody::Empty => BodySize::Empty, AnyBody::Bytes(ref bin) => BodySize::Sized(bin.len() as u64), - AnyBody::Message(ref body) => body.size(), + AnyBody::Stream(ref body) => body.size(), } } @@ -74,7 +74,7 @@ impl MessageBody for AnyBody { } } - AnyBody::Message(body) => body + AnyBody::Stream(body) => body .as_pin_mut() .poll_next(cx) .map_err(|err| Error::new_body().with_cause(err)), @@ -91,7 +91,7 @@ impl PartialEq for AnyBody { AnyBody::Bytes(ref b2) => b == b2, _ => false, }, - AnyBody::Message(_) => false, + AnyBody::Stream(_) => false, } } } @@ -102,7 +102,7 @@ impl fmt::Debug for AnyBody { AnyBody::None => write!(f, "AnyBody::None"), AnyBody::Empty => write!(f, "AnyBody::Empty"), AnyBody::Bytes(ref b) => write!(f, "AnyBody::Bytes({:?})", b), - AnyBody::Message(_) => write!(f, "AnyBody::Message(_)"), + AnyBody::Stream(_) => write!(f, "AnyBody::Message(_)"), } } } diff --git a/actix-http/src/encoding/encoder.rs b/actix-http/src/encoding/encoder.rs index abd8cedba..e2faf9418 100644 --- a/actix-http/src/encoding/encoder.rs +++ b/actix-http/src/encoding/encoder.rs @@ -69,7 +69,7 @@ impl Encoder { return ResponseBody::Other(Body::Bytes(buf)); } } - Body::Message(stream) => EncoderBody::BoxedStream(stream), + Body::Stream(stream) => EncoderBody::BoxedStream(stream), }, ResponseBody::Body(stream) => EncoderBody::Stream(stream), };