pub struct BytesCodec;
Expand description
Bytes codec.
Reads/Writes chunks of bytes from a stream.
Trait Implementations§
Source§impl Clone for BytesCodec
impl Clone for BytesCodec
Source§fn clone(&self) -> BytesCodec
fn clone(&self) -> BytesCodec
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for BytesCodec
impl Debug for BytesCodec
Source§impl Decoder for BytesCodec
impl Decoder for BytesCodec
Source§type DecodeItem = BytesMut
type DecodeItem = BytesMut
The type of decoded frames.
Source§type DecodeError = Error
type DecodeError = Error
The type of unrecoverable frame decoding errors. Read more
Source§fn decode(
&self,
src: &mut BytesMut,
) -> Result<Option<Self::DecodeItem>, Self::DecodeError>
fn decode( &self, src: &mut BytesMut, ) -> Result<Option<Self::DecodeItem>, Self::DecodeError>
Attempts to decode a frame from the provided buffer of bytes.
Source§fn decode_vec(
&self,
src: &mut BytesVec,
) -> Result<Option<Self::DecodeItem>, Self::DecodeError>
fn decode_vec( &self, src: &mut BytesVec, ) -> Result<Option<Self::DecodeItem>, Self::DecodeError>
Attempts to decode a frame from the provided buffer of bytes.
Source§impl Encoder for BytesCodec
impl Encoder for BytesCodec
Source§type EncodeItem = Bytes
type EncodeItem = Bytes
The type of items consumed by the
Encoder
Source§type EncodeError = Error
type EncodeError = Error
The type of encoding errors.
Source§fn encode(
&self,
item: Bytes,
dst: &mut BytesMut,
) -> Result<(), Self::EncodeError>
fn encode( &self, item: Bytes, dst: &mut BytesMut, ) -> Result<(), Self::EncodeError>
Encodes a frame into the buffer provided.
Source§fn encode_vec(
&self,
item: Self::EncodeItem,
dst: &mut BytesVec,
) -> Result<(), Self::EncodeError>
fn encode_vec( &self, item: Self::EncodeItem, dst: &mut BytesVec, ) -> Result<(), Self::EncodeError>
Encodes a frame into the buffer provided.
impl Copy for BytesCodec
Auto Trait Implementations§
impl Freeze for BytesCodec
impl RefUnwindSafe for BytesCodec
impl Send for BytesCodec
impl Sync for BytesCodec
impl Unpin for BytesCodec
impl UnwindSafe for BytesCodec
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more