Trait BytesEncode

Source
pub trait BytesEncode<'a> {
    type EItem: ?Sized + 'a;

    // Required method
    fn bytes_encode(item: &'a Self::EItem) -> Result<Cow<'a, [u8]>, BoxedError>;
}
Expand description

A trait that represents an encoding structure.

Required Associated Types§

Source

type EItem: ?Sized + 'a

The type to encode.

Required Methods§

Source

fn bytes_encode(item: &'a Self::EItem) -> Result<Cow<'a, [u8]>, BoxedError>

Encode the given item as bytes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

impl BytesEncode<'_> for Str

impl BytesEncode<'_> for Unit

impl BytesEncode<'_> for I8

impl BytesEncode<'_> for U8

impl<'a> BytesEncode<'a> for Bytes

impl<'a, T> BytesEncode<'a> for SerdeBincode<T>
where T: Serialize + 'a,

impl<'a, T> BytesEncode<'a> for SerdeJson<T>
where T: Serialize + 'a,

impl<O: ByteOrder> BytesEncode<'_> for I128<O>

impl<O: ByteOrder> BytesEncode<'_> for I16<O>

impl<O: ByteOrder> BytesEncode<'_> for I32<O>

impl<O: ByteOrder> BytesEncode<'_> for I64<O>

impl<O: ByteOrder> BytesEncode<'_> for U128<O>

impl<O: ByteOrder> BytesEncode<'_> for U16<O>

impl<O: ByteOrder> BytesEncode<'_> for U32<O>

impl<O: ByteOrder> BytesEncode<'_> for U64<O>