Skip to main content

StreamingChunkDecoder

Struct StreamingChunkDecoder 

Source
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

Source

pub fn new(position: usize, limits: Limits) -> Self

Source

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.

Source

pub const fn body_bytes(&self) -> usize

Source

pub const fn consumed_prefix(&self) -> usize

Wire prefix fully consumed by emitted events.

Source

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§

Source§

impl Debug for StreamingChunkDecoder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.