pub struct ChunkedReader<'a> { /* private fields */ }Expand description
Parses chunked transfer encoding.
Chunked encoding format:
chunk-size CRLF
chunk-data CRLF
...
0 CRLF
[trailers] CRLFImplementations§
Source§impl<'a> ChunkedReader<'a>
impl<'a> ChunkedReader<'a>
Sourcepub fn new(buffer: &'a [u8], config: &BodyConfig) -> Self
pub fn new(buffer: &'a [u8], config: &BodyConfig) -> Self
Create a new chunked reader.
§Arguments
buffer- The buffer containing chunked body dataconfig- Body reading configuration
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Returns true if parsing is complete.
Sourcepub fn total_size(&self) -> usize
pub fn total_size(&self) -> usize
Returns the total decoded body size so far.
Sourcepub fn decode_all(&mut self) -> Result<Vec<u8>, BodyError>
pub fn decode_all(&mut self) -> Result<Vec<u8>, BodyError>
Decode all chunks into a single buffer.
§Errors
Returns an error if:
- The total size exceeds the configured limit
- The chunked encoding is malformed
- The buffer is incomplete
Sourcepub fn bytes_consumed(&self) -> usize
pub fn bytes_consumed(&self) -> usize
Returns the number of bytes consumed from the raw buffer.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for ChunkedReader<'a>
impl<'a> RefUnwindSafe for ChunkedReader<'a>
impl<'a> Send for ChunkedReader<'a>
impl<'a> Sync for ChunkedReader<'a>
impl<'a> Unpin for ChunkedReader<'a>
impl<'a> UnwindSafe for ChunkedReader<'a>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).