Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Implement Display for Find
  • Loading branch information
aaamourao committed Apr 20, 2025
commit 69d02971efbd1ea2a1a240f5b28ba861ba51035e
18 changes: 17 additions & 1 deletion futures-util/src/stream/stream/find.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::fns::FnMut1;
use crate::Stream;

use core::fmt;
use core::future::Future;
use core::pin::Pin;
use core::task::{ready, Context, Poll};
Expand All @@ -9,7 +10,6 @@ use pin_project_lite::pin_project;

pin_project! {
/// Future for the [`find`](super::StreamExt::find) method.
#[derive(Debug)]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Find<St, Fut, F>
where St: Stream,
Expand All @@ -24,6 +24,22 @@ pin_project! {
}
}

impl<St, Fut, F> fmt::Debug for Find<St, Fut, F>
where
St: Stream + fmt::Debug,
St::Item: fmt::Debug,
Fut: fmt::Debug,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Find")
.field("stream", &self.stream)
.field("done", &self.done)
.field("pending_fut", &self.pending_fut)
.field("pending_item", &self.pending_item)
.finish()
}
}

impl<St, Fut, F> Find<St, Fut, F>
where
St: Stream,
Expand Down