diff --git a/actix-http/src/body/boxed.rs b/actix-http/src/body/boxed.rs index a2d7540c4..0c6950a1f 100644 --- a/actix-http/src/body/boxed.rs +++ b/actix-http/src/body/boxed.rs @@ -11,6 +11,7 @@ use super::{BodySize, MessageBody, MessageBodyMapErr}; use crate::body; /// A boxed message body with boxed errors. +#[derive(Debug)] pub struct BoxBody(BoxBodyInner); enum BoxBodyInner { @@ -19,6 +20,16 @@ enum BoxBodyInner { Stream(Pin>>>), } +impl fmt::Debug for BoxBodyInner { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::None(arg0) => f.debug_tuple("None").field(arg0).finish(), + Self::Bytes(arg0) => f.debug_tuple("Bytes").field(arg0).finish(), + Self::Stream(_) => f.debug_tuple("Stream").field(&"dyn MessageBody").finish(), + } + } +} + impl BoxBody { /// Same as `MessageBody::boxed`. /// @@ -48,13 +59,6 @@ impl BoxBody { } } -impl fmt::Debug for BoxBody { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - // TODO show BoxBodyInner - f.write_str("BoxBody(dyn MessageBody)") - } -} - impl MessageBody for BoxBody { type Error = Box;