pub struct StreamingChunkDecoder { /* private fields */ }Expand description
Zero-aggregate incremental chunked decoder for streaming request bodies.
Unlike ChunkDecoder, this decoder never builds a complete body. Each
returned range can be copied into a bounded transport channel and released
before reading the next network chunk.
Implementations§
Source§impl StreamingChunkDecoder
impl StreamingChunkDecoder
pub fn new(position: usize, limits: Limits) -> Self
Sourcepub fn advance(&mut self, buffer: &[u8]) -> Result<StreamingChunk, ParseError>
pub fn advance(&mut self, buffer: &[u8]) -> Result<StreamingChunk, ParseError>
Advances by at most one decoded data chunk.
§Errors
Returns a bounded protocol rejection for malformed chunks/trailers or configured body and chunk-count limit violations.
pub const fn body_bytes(&self) -> usize
Sourcepub const fn consumed_prefix(&self) -> usize
pub const fn consumed_prefix(&self) -> usize
Wire prefix fully consumed by emitted events.
Sourcepub fn discard_prefix(&mut self, bytes: usize)
pub fn discard_prefix(&mut self, bytes: usize)
Rebases decoder offsets after the caller discards a consumed prefix.
§Panics
Panics when bytes exceeds Self::consumed_prefix.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StreamingChunkDecoder
impl RefUnwindSafe for StreamingChunkDecoder
impl Send for StreamingChunkDecoder
impl Sync for StreamingChunkDecoder
impl Unpin for StreamingChunkDecoder
impl UnsafeUnpin for StreamingChunkDecoder
impl UnwindSafe for StreamingChunkDecoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more