diff --git a/tower-batch/src/future.rs b/tower-batch/src/future.rs index 300f79bf..a460bbc5 100644 --- a/tower-batch/src/future.rs +++ b/tower-batch/src/future.rs @@ -13,7 +13,6 @@ use tower::Service; /// Future that completes when the batch processing is complete. #[pin_project] -#[derive(Debug)] pub struct ResponseFuture where T: Service>, @@ -22,6 +21,20 @@ where state: ResponseState, } +impl Debug for ResponseFuture +where + T: Service>, + T::Future: Debug, + T::Error: Debug, + E: Debug, +{ + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("ResponseFuture") + .field("state", &self.state) + .finish() + } +} + #[pin_project(project = ResponseStateProj)] enum ResponseState where @@ -35,9 +48,16 @@ where impl Debug for ResponseState where T: Service>, + T::Future: Debug, + T::Error: Debug, + E: Debug, { - fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - todo!() + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + ResponseState::Failed(e) => f.debug_tuple("ResponseState::Failed").field(e).finish(), + ResponseState::Rx(rx) => f.debug_tuple("ResponseState::Rx").field(rx).finish(), + ResponseState::Poll(fut) => f.debug_tuple("ResponseState::Pool").field(fut).finish(), + } } }