pub struct FrameDriver<D> { /* private fields */ }Expand description
Bounded, terminal-on-malformation driver for one incremental decoder.
Implementations§
Source§impl<D: FrameDecoder> FrameDriver<D>
impl<D: FrameDecoder> FrameDriver<D>
Sourcepub fn new(
decoder: D,
max_retained_bytes: RetainedBytes,
) -> Result<Self, FrameDecodeError<D::Error>>
pub fn new( decoder: D, max_retained_bytes: RetainedBytes, ) -> Result<Self, FrameDecodeError<D::Error>>
Wraps a decoder if its initial retained memory is within the bound.
Sourcepub fn feed(&mut self, bytes: &[u8]) -> Result<(), FrameDecodeError<D::Error>>
pub fn feed(&mut self, bytes: &[u8]) -> Result<(), FrameDecodeError<D::Error>>
Admits a borrowed byte chunk or leaves it entirely with the caller.
Sourcepub fn next_frame(
&mut self,
) -> Result<Option<D::Frame>, FrameDecodeError<D::Error>>
pub fn next_frame( &mut self, ) -> Result<Option<D::Frame>, FrameDecodeError<D::Error>>
Extracts at most one complete opaque frame.
Sourcepub fn retained_bytes(&self) -> RetainedBytes
pub fn retained_bytes(&self) -> RetainedBytes
Returns variable memory retained by the adapter decoder.
Sourcepub const fn is_failed(&self) -> bool
pub const fn is_failed(&self) -> bool
Returns whether a terminal adapter or accounting failure occurred.
Sourcepub fn into_decoder(self) -> D
pub fn into_decoder(self) -> D
Recovers the protocol-owned decoder.
Trait Implementations§
Auto Trait Implementations§
impl<D> Freeze for FrameDriver<D>where
D: Freeze,
impl<D> RefUnwindSafe for FrameDriver<D>where
D: RefUnwindSafe,
impl<D> Send for FrameDriver<D>where
D: Send,
impl<D> Sync for FrameDriver<D>where
D: Sync,
impl<D> Unpin for FrameDriver<D>where
D: Unpin,
impl<D> UnsafeUnpin for FrameDriver<D>where
D: UnsafeUnpin,
impl<D> UnwindSafe for FrameDriver<D>where
D: UnwindSafe,
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