pub struct CapsuleDecoder { /* private fields */ }Expand description
An incremental capsule decoder.
Feed it bytes with CapsuleDecoder::push, then drain with
CapsuleDecoder::next_capsule until it yields None.
Implementations§
Source§impl CapsuleDecoder
impl CapsuleDecoder
Sourcepub fn push(&mut self, chunk: &[u8])
pub fn push(&mut self, chunk: &[u8])
Adds received bytes. Any number, split anywhere.
Taken by slice because that is all this does with them: the bytes are copied into the decoder’s own buffer, where the next capsule is cut out of them, so nothing is gained by owning the chunk they arrived in.
Sourcepub fn at_capsule_boundary(&self) -> bool
pub fn at_capsule_boundary(&self) -> bool
Whether the sequence is currently between capsules.
False at end of stream means the peer stopped mid-capsule, which RFC 9297 §3.3 makes a malformed message.
Trait Implementations§
Source§impl Debug for CapsuleDecoder
impl Debug for CapsuleDecoder
Auto Trait Implementations§
impl Freeze for CapsuleDecoder
impl RefUnwindSafe for CapsuleDecoder
impl Send for CapsuleDecoder
impl Sync for CapsuleDecoder
impl Unpin for CapsuleDecoder
impl UnsafeUnpin for CapsuleDecoder
impl UnwindSafe for CapsuleDecoder
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