pub trait NativeType: Sealed + Pod + Send + Sync + Sized + Debug + Display + PartialEq + Default {
    type Bytes: AsRef<[u8]> + Index<usize, Output = u8> + IndexMut<usize, Output = u8> + for<'a> TryFrom<&'a [u8]> + Debug + Default;

    const PRIMITIVE: PrimitiveType;

    fn to_le_bytes(&self) -> Self::Bytes;
    fn to_be_bytes(&self) -> Self::Bytes;
    fn from_le_bytes(bytes: Self::Bytes) -> Self;
    fn from_be_bytes(bytes: Self::Bytes) -> Self;
}
Expand description

Sealed trait implemented by all physical types that can be allocated, serialized and deserialized by this crate. All O(N) allocations in this crate are done for this trait alone.

Required Associated Types

Type denoting its representation as bytes. This is [u8; N] where N = size_of::<T>.

Required Associated Constants

The corresponding variant of PrimitiveType.

Required Methods

To bytes in little endian

To bytes in big endian

From bytes in little endian

From bytes in big endian

Implementations on Foreign Types

Implementors