diff --git a/futures-util/src/stream/select.rs b/futures-util/src/stream/select.rs index 86c7bb355d..0c1e3af782 100644 --- a/futures-util/src/stream/select.rs +++ b/futures-util/src/stream/select.rs @@ -7,6 +7,7 @@ use pin_project_lite::pin_project; pin_project! { /// Stream for the [`select()`] function. + #[derive(Debug)] #[must_use = "streams do nothing unless polled"] pub struct Select { #[pin] diff --git a/futures-util/src/stream/select_with_strategy.rs b/futures-util/src/stream/select_with_strategy.rs index 238103db80..1b501132c5 100644 --- a/futures-util/src/stream/select_with_strategy.rs +++ b/futures-util/src/stream/select_with_strategy.rs @@ -1,6 +1,6 @@ use super::assert_stream; use crate::stream::{Fuse, StreamExt}; -use core::pin::Pin; +use core::{fmt, pin::Pin}; use futures_core::stream::{FusedStream, Stream}; use futures_core::task::{Context, Poll}; use pin_project_lite::pin_project; @@ -36,7 +36,6 @@ impl Default for PollNext { pin_project! { /// Stream for the [`select_with_strategy()`] function. See function docs for details. - #[derive(Debug)] #[must_use = "streams do nothing unless polled"] pub struct SelectWithStrategy { #[pin] @@ -214,3 +213,18 @@ where Poll::Ready(None) | Poll::Pending => Poll::Pending, } } + +impl fmt::Debug for SelectWithStrategy +where + St1: fmt::Debug, + St2: fmt::Debug, + State: fmt::Debug, +{ + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("SelectWithStrategy") + .field("stream1", &self.stream1) + .field("stream2", &self.stream2) + .field("state", &self.state) + .finish() + } +}