Struct BytesCodec
pub struct BytesCodec(/* private field */);
A simple Decoder and Encoder implementation that just ships bytes around.
Example
Turn an AsyncRead into a stream of Result<BytesMut, Error>.
#
use AsyncRead;
use ;
#
#
#
#
# async
Implementations
impl BytesCodec
fn new() -> BytesCodecCreates a new
BytesCodecfor shipping around raw bytes.
Trait Implementations
impl Clone for BytesCodec
fn clone(&self) -> BytesCodec
impl Copy for BytesCodec
impl Debug for BytesCodec
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Decoder for BytesCodec
type Item = BytesMut;type Error = Error;fn decode(&mut self, buf: &mut BytesMut) -> Result<Option<BytesMut>, Error>
impl Default for BytesCodec
fn default() -> BytesCodec
impl Encoder<Bytes> for BytesCodec
type Error = Error;fn encode(&mut self, data: Bytes, buf: &mut BytesMut) -> Result<(), Error>
impl Encoder<BytesMut> for BytesCodec
type Error = Error;fn encode(&mut self, data: BytesMut, buf: &mut BytesMut) -> Result<(), Error>
impl Eq for BytesCodec
impl Hash for BytesCodec
fn hash<__H: Hasher>(&self, state: &mut __H)
impl Ord for BytesCodec
fn cmp(&self, other: &BytesCodec) -> Ordering
impl PartialEq for BytesCodec
fn eq(&self, other: &BytesCodec) -> bool
impl PartialOrd for BytesCodec
fn partial_cmp(&self, other: &BytesCodec) -> Option<Ordering>
impl StructuralPartialEq 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 UnsafeUnpin for BytesCodec
impl UnwindSafe for BytesCodec
Blanket Implementations
impl<T> Any for BytesCodec
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for BytesCodec
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for BytesCodec
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for BytesCodec
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for BytesCodec
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for BytesCodec
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for BytesCodec
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 BytesCodec
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 BytesCodec
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>