pub struct ChunkedDecoder {
state: DecoderState,
size_buffer: Vec<u8>,
current_chunk_size: usize,
chunk_bytes_read: usize,
output: Vec<u8>,
}Expand description
Chunked transfer encoding decoder.
Handles incremental decoding for streaming scenarios.
Fields§
§state: DecoderStateCurrent decoder state.
size_buffer: Vec<u8>Buffer for incomplete chunk size line.
current_chunk_size: usizeExpected size of current chunk.
chunk_bytes_read: usizeBytes read in current chunk.
output: Vec<u8>Decoded output data.
Implementations§
Source§impl ChunkedDecoder
impl ChunkedDecoder
Sourcepub fn state(&self) -> DecoderState
pub fn state(&self) -> DecoderState
Get current decoder state.
Sourcepub fn take_output(self) -> Vec<u8>
pub fn take_output(self) -> Vec<u8>
Take ownership of the decoded output.
Sourcepub fn decode(data: &[u8]) -> Result<Vec<u8>>
pub fn decode(data: &[u8]) -> Result<Vec<u8>>
Decode a complete chunked body in one go.
Returns the decoded data.
Sourcepub fn feed(&mut self, data: &[u8]) -> Result<usize>
pub fn feed(&mut self, data: &[u8]) -> Result<usize>
Feed data to the decoder incrementally.
Returns the number of bytes consumed.
Sourcefn parse_chunk_size(&mut self) -> Result<()>
fn parse_chunk_size(&mut self) -> Result<()>
Parse the chunk size from size_buffer.
Trait Implementations§
Source§impl Debug for ChunkedDecoder
impl Debug for ChunkedDecoder
Auto Trait Implementations§
impl Freeze for ChunkedDecoder
impl RefUnwindSafe for ChunkedDecoder
impl Send for ChunkedDecoder
impl Sync for ChunkedDecoder
impl Unpin for ChunkedDecoder
impl UnwindSafe for ChunkedDecoder
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