From c5cf01907b5d764f296f740c712a2613d786ae4a Mon Sep 17 00:00:00 2001 From: Paul Loyd Date: Sun, 16 Feb 2025 12:19:10 +0400 Subject: [PATCH] feat(cursors/bytes): add `BytesCursor::{received_bytes,decoded_bytes}` --- src/cursors/bytes.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/cursors/bytes.rs b/src/cursors/bytes.rs index 71d5de5..2e2c8f0 100644 --- a/src/cursors/bytes.rs +++ b/src/cursors/bytes.rs @@ -43,6 +43,23 @@ impl BytesCursor { None => Poll::Ready(Ok(false)), } } + + /// Returns the total size in bytes received from the CH server since + /// the cursor was created. + /// + /// This method counts only size without HTTP headers for now. + /// It can be changed in the future without notice. + #[inline] + pub fn received_bytes(&self) -> u64 { + self.raw.received_bytes() + } + + /// Returns the total size in bytes decompressed since the cursor was + /// created. + #[inline] + pub fn decoded_bytes(&self) -> u64 { + self.raw.decoded_bytes() + } } impl AsyncRead for BytesCursor {