pub struct ChunkedDecoder { /* private fields */ }Expand description
The state of a chunked body decode (RFC 9112 §7.1).
The decoder owns no buffer: ChunkedDecoder::step reads the caller’s
input and returns slices of it. On an error the state is unchanged, so a
caller that got DecodeError::Incomplete calls again with more input.
Implementations§
Source§impl ChunkedDecoder
impl ChunkedDecoder
Sourcepub fn step<'a>(
&mut self,
input: &'a [u8],
limits: Limits,
) -> Result<(Chunk<'a>, usize), DecodeError>
pub fn step<'a>( &mut self, input: &'a [u8], limits: Limits, ) -> Result<(Chunk<'a>, usize), DecodeError>
Decodes the next piece of the body from input. Returns it and the
octets it used.
Chunk::Data is at most the rest of the current chunk that input
holds. Chunk extensions are stepped over but count toward
Limits::max_chunk_line; trailers follow the head’s field rules and
Limits::max_head_bytes.
§Errors
Incomplete; TooLarge "chunk line" or "trailer section";
Malformed "chunk size", "chunk data terminator", or a field rule;
Malformed "chunked body already ended" after Chunk::End.
Trait Implementations§
Source§impl Clone for ChunkedDecoder
impl Clone for ChunkedDecoder
Source§impl Debug for ChunkedDecoder
impl Debug for ChunkedDecoder
Source§impl Default for ChunkedDecoder
impl Default for ChunkedDecoder
impl Eq for ChunkedDecoder
Source§impl PartialEq for ChunkedDecoder
impl PartialEq for ChunkedDecoder
impl StructuralPartialEq 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 UnsafeUnpin 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