pub trait BytesEncode<'a> {
type EItem: ?Sized + 'a;
// Required method
fn bytes_encode(item: &'a Self::EItem) -> Result<Cow<'a, [u8]>, EncodeError>;
}Expand description
A trait that represents an encoding structure.
Required Associated Types§
Required Methods§
Sourcefn bytes_encode(item: &'a Self::EItem) -> Result<Cow<'a, [u8]>, EncodeError>
fn bytes_encode(item: &'a Self::EItem) -> Result<Cow<'a, [u8]>, EncodeError>
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".
Implementations on Foreign Types§
Source§impl BytesEncode<'_> for &[u8]
impl BytesEncode<'_> for &[u8]
Source§impl BytesEncode<'_> for &str
impl BytesEncode<'_> for &str
Source§impl BytesEncode<'_> for String
impl BytesEncode<'_> for String
Source§impl BytesEncode<'_> for Vec<u8>
impl BytesEncode<'_> for Vec<u8>
Source§impl BytesEncode<'_> for bool
impl BytesEncode<'_> for bool
Source§impl BytesEncode<'_> for i16
Encodable version of i16 (Little Endian).
impl BytesEncode<'_> for i16
Encodable version of i16 (Little Endian).
Source§impl BytesEncode<'_> for i32
Encodable version of i32 (Little Endian).
impl BytesEncode<'_> for i32
Encodable version of i32 (Little Endian).
Source§impl BytesEncode<'_> for i64
Encodable version of i64 (Little Endian).
impl BytesEncode<'_> for i64
Encodable version of i64 (Little Endian).
Source§impl BytesEncode<'_> for i128
Encodable version of i128 (Little Endian).
impl BytesEncode<'_> for i128
Encodable version of i128 (Little Endian).
Source§impl BytesEncode<'_> for u8
impl BytesEncode<'_> for u8
Source§impl BytesEncode<'_> for u16
Encodable version of u16 (Little Endian).
impl BytesEncode<'_> for u16
Encodable version of u16 (Little Endian).
Source§impl BytesEncode<'_> for u32
Encodable version of u32 (Little Endian).
impl BytesEncode<'_> for u32
Encodable version of u32 (Little Endian).
Source§impl BytesEncode<'_> for u64
Encodable version of u64 (Little Endian).
impl BytesEncode<'_> for u64
Encodable version of u64 (Little Endian).
Source§impl BytesEncode<'_> for u128
Encodable version of u128 (Little Endian).
impl BytesEncode<'_> for u128
Encodable version of u128 (Little Endian).