pub struct LengthPrefixedFrame { /* private fields */ }Expand description
Decodes arbitrary fragmented or coalesced HTTP/2 DATA payloads.
Length limits are checked before allocating a message body. A failed decoder
rejects further input until reset. An error from push discards any messages
completed in that call; callers must terminate the affected RPC stream.
Implementations§
Source§impl LengthPrefixedFrame
impl LengthPrefixedFrame
Sourcepub fn new(max_message_size: usize) -> Self
pub fn new(max_message_size: usize) -> Self
Creates a decoder with a maximum encoded payload length in bytes.
Sourcepub fn push(&mut self, chunk: &[u8]) -> Result<Vec<AlignedMessageBuf>, Status>
pub fn push(&mut self, chunk: &[u8]) -> Result<Vec<AlignedMessageBuf>, Status>
Consumes one DATA chunk and returns every complete message in wire order.
Empty chunks are valid. Partial headers and bodies remain buffered until the next call. Compression negotiation and decompression belong to the caller.
§Errors
Returns internal for an invalid compressed flag, resource exhausted for oversized messages or allocation failure, or the previous decoder failure.
Trait Implementations§
Source§impl Debug for LengthPrefixedFrame
impl Debug for LengthPrefixedFrame
Auto Trait Implementations§
impl Freeze for LengthPrefixedFrame
impl RefUnwindSafe for LengthPrefixedFrame
impl Send for LengthPrefixedFrame
impl Sync for LengthPrefixedFrame
impl Unpin for LengthPrefixedFrame
impl UnsafeUnpin for LengthPrefixedFrame
impl UnwindSafe for LengthPrefixedFrame
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