Skip to content

Commit dc41f24

Browse files
committed
[ChunksTimeout] Consumes the stream and return the buffered items immediately
Summary: When the underlying stream is an exclusive reference (&mut stream), and we need to drop the `ChunksTimout` stream without losing the buffered items.
1 parent 5a709e3 commit dc41f24

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tokio-stream/src/stream_ext/chunks_timeout.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ impl<S: Stream> ChunksTimeout<S> {
3333
cap: max_size,
3434
}
3535
}
36+
37+
/// Consumes the stream and immediately return the buffered items.
38+
pub fn remaining(self) -> Vec<S::Item> {
39+
self.items
40+
}
3641
}
3742

3843
impl<S: Stream> Stream for ChunksTimeout<S> {

0 commit comments

Comments
 (0)