pub struct ProtobufLenPrefixCodec<T> { /* private fields */ }Available on crate feature
protobuf only.Expand description
A Decoder that yields one message per length-prefixed frame.
Implementations§
Source§impl<T> ProtobufLenPrefixCodec<T>
impl<T> ProtobufLenPrefixCodec<T>
Sourcepub fn new_with_max_length(max_length: usize) -> Self
pub fn new_with_max_length(max_length: usize) -> Self
A codec that rejects any single message longer than max_length bytes.
Trait Implementations§
Source§impl<T: Clone> Clone for ProtobufLenPrefixCodec<T>
impl<T: Clone> Clone for ProtobufLenPrefixCodec<T>
Source§fn clone(&self) -> ProtobufLenPrefixCodec<T>
fn clone(&self) -> ProtobufLenPrefixCodec<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for ProtobufLenPrefixCodec<T>
impl<T: Debug> Debug for ProtobufLenPrefixCodec<T>
Source§impl<T> Decoder for ProtobufLenPrefixCodec<T>
impl<T> Decoder for ProtobufLenPrefixCodec<T>
Source§type Item = Result<T, StreamError>
type Item = Result<T, StreamError>
Always Ok(_): a message that fails to decode is reported as terminal, matching the
behaviour this codec has always had.
Source§type Error = StreamError
type Error = StreamError
The type of unrecoverable frame decoding errors. Read more
Source§fn decode(
&mut self,
buf: &mut BytesMut,
) -> Result<Option<Self::Item>, StreamError>
fn decode( &mut self, buf: &mut BytesMut, ) -> Result<Option<Self::Item>, StreamError>
Attempts to decode a frame from the provided buffer of bytes. Read more
Source§fn decode_eof(
&mut self,
buf: &mut BytesMut,
) -> Result<Option<Self::Item>, StreamError>
fn decode_eof( &mut self, buf: &mut BytesMut, ) -> Result<Option<Self::Item>, StreamError>
A default method available to be called when there are no more bytes
available to be read from the underlying I/O. Read more
Auto Trait Implementations§
impl<T> Freeze for ProtobufLenPrefixCodec<T>
impl<T> RefUnwindSafe for ProtobufLenPrefixCodec<T>
impl<T> Send for ProtobufLenPrefixCodec<T>
impl<T> Sync for ProtobufLenPrefixCodec<T>
impl<T> Unpin for ProtobufLenPrefixCodec<T>
impl<T> UnsafeUnpin for ProtobufLenPrefixCodec<T>
impl<T> UnwindSafe for ProtobufLenPrefixCodec<T>
Blanket Implementations§
impl<T> Allocation for T
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