Skip to content

Commit 0e4dc7d

Browse files
ibraheemdevtaiki-e
authored andcommitted
add size_hint to mpsc receiver
1 parent bbc403a commit 0e4dc7d

File tree

1 file changed

+5
-1
lines changed
  • futures-channel/src/mpsc

1 file changed

+5
-1
lines changed

futures-channel/src/mpsc/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ struct UnboundedInner<T> {
282282

283283
#[derive(Debug)]
284284
struct BoundedInner<T> {
285-
// Max buffer size of the channel. If `None` then the channel is unbounded.
285+
// Max buffer size of the channel.
286286
buffer: usize,
287287

288288
// Internal channel state. Consists of the number of messages stored in the
@@ -1125,6 +1125,10 @@ impl<T> Stream for Receiver<T> {
11251125
}
11261126
}
11271127
}
1128+
1129+
fn size_hint(&self) -> (usize, Option<usize>) {
1130+
(0, self.inner.as_ref().map(|i| i.buffer))
1131+
}
11281132
}
11291133

11301134
impl<T> Drop for Receiver<T> {

0 commit comments

Comments
 (0)