stream: add ChunksTimeout::into_remainder (#7715)

This commit is contained in:
Muhamad Awad
2025-11-06 20:15:10 +08:00
committed by GitHub
parent d84a9e9af3
commit 62ecff895a
2 changed files with 36 additions and 0 deletions
@@ -33,6 +33,12 @@ impl<S: Stream> ChunksTimeout<S> {
cap: max_size,
}
}
/// Consumes the [`ChunksTimeout`] and then returns all buffered items.
pub fn into_remainder(mut self: Pin<&mut Self>) -> Vec<S::Item> {
let me = self.as_mut().project();
std::mem::take(me.items)
}
}
impl<S: Stream> Stream for ChunksTimeout<S> {