Struct LengthDelimitedCodec

struct LengthDelimitedCodec { ... }

A codec for frames delimited by a frame head specifying their lengths.

This allows the consumer to work with entire frames without having to worry about buffering or other framing logic.

See module level documentation for more detail.

Implementations

impl LengthDelimitedCodec

fn new() -> Self

Creates a new LengthDelimitedCodec with the default configuration values.

fn builder() -> Builder

Creates a new length delimited codec builder with default configuration values.

fn max_frame_length(self: &Self) -> usize

Returns the current max frame setting

This is the largest size this codec will accept from the wire. Larger frames will be rejected.

fn set_max_frame_length(self: &mut Self, val: usize)

Updates the max frame setting.

The change takes effect the next time a frame is decoded. In other words, if a frame is currently in process of being decoded with a frame size greater than val but less than the max frame length in effect before calling this function, then the frame will be allowed.

impl Clone for LengthDelimitedCodec

fn clone(self: &Self) -> LengthDelimitedCodec

impl Debug for LengthDelimitedCodec

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

impl Decoder for LengthDelimitedCodec

fn decode(self: &mut Self, src: &mut BytesMut) -> Result<Option<BytesMut>>

impl Default for LengthDelimitedCodec

fn default() -> Self

impl Encoder for LengthDelimitedCodec

fn encode(self: &mut Self, data: Bytes, dst: &mut BytesMut) -> Result<(), Error>

impl Freeze for LengthDelimitedCodec

impl RefUnwindSafe for LengthDelimitedCodec

impl Send for LengthDelimitedCodec

impl Sync for LengthDelimitedCodec

impl Unpin for LengthDelimitedCodec

impl UnsafeUnpin for LengthDelimitedCodec

impl UnwindSafe for LengthDelimitedCodec

impl<T> Any for LengthDelimitedCodec

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for LengthDelimitedCodec

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for LengthDelimitedCodec

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

impl<T> CloneToUninit for LengthDelimitedCodec

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for LengthDelimitedCodec

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for LengthDelimitedCodec

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for LengthDelimitedCodec

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for LengthDelimitedCodec

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for LengthDelimitedCodec

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