Struct LengthDelimitedCodec
pub struct LengthDelimitedCodec { /* private fields */ }
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() -> SelfCreates a new
LengthDelimitedCodecwith the default configuration values.fn builder() -> BuilderCreates a new length delimited codec builder with default configuration values.
fn max_frame_length(&self) -> usizeReturns 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(&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
valbut less than the max frame length in effect before calling this function, then the frame will be allowed.
Trait Implementations
impl Clone for LengthDelimitedCodec
fn clone(&self) -> LengthDelimitedCodec
impl Debug for LengthDelimitedCodec
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Decoder for LengthDelimitedCodec
type Item = BytesMut;type Error = Error;fn decode(&mut self, src: &mut BytesMut) -> Result<Option<BytesMut>>
impl Default for LengthDelimitedCodec
fn default() -> Self
impl Encoder<Bytes> for LengthDelimitedCodec
type Error = Error;fn encode(&mut self, data: Bytes, dst: &mut BytesMut) -> Result<(), Error>
Auto Trait Implementations
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
Blanket Implementations
impl<T> Any for LengthDelimitedCodec
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for LengthDelimitedCodec
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for LengthDelimitedCodec
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for LengthDelimitedCodec
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for LengthDelimitedCodec
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for LengthDelimitedCodec
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for LengthDelimitedCodec
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for LengthDelimitedCodec
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for LengthDelimitedCodec
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>