Byteable

Trait Byteable 

Source
pub trait Byteable: Copy {
    type ByteArray: ByteableByteArray;

    // Required methods
    fn as_bytearray(self) -> Self::ByteArray;
    fn from_bytearray(ba: Self::ByteArray) -> Self;
    fn binary_size() -> usize;
}
Expand description

Trait for types that can be converted to and from a byte array.

This trait is central to the byteable crate, enabling structured data to be easily serialized into and deserialized from byte arrays.

Required Associated Types§

Source

type ByteArray: ByteableByteArray

The associated byte array type that can represent Self.

Required Methods§

Source

fn as_bytearray(self) -> Self::ByteArray

Converts self into its ByteableByteArray representation.

Source

fn from_bytearray(ba: Self::ByteArray) -> Self

Creates an instance of Self from a ByteableByteArray.

Source

fn binary_size() -> usize

Returns the size in bytes of the binary representation of this type.

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§

Source§

impl Byteable for BigEndian<f32>

Source§

impl Byteable for BigEndian<f64>

Source§

impl Byteable for BigEndian<i8>

Source§

impl Byteable for BigEndian<i16>

Source§

impl Byteable for BigEndian<i32>

Source§

impl Byteable for BigEndian<i64>

Source§

impl Byteable for BigEndian<i128>

Source§

impl Byteable for BigEndian<isize>

Source§

impl Byteable for BigEndian<u8>

Source§

impl Byteable for BigEndian<u16>

Source§

impl Byteable for BigEndian<u32>

Source§

impl Byteable for BigEndian<u64>

Source§

impl Byteable for BigEndian<u128>

Source§

impl Byteable for BigEndian<usize>

Source§

impl Byteable for LittleEndian<f32>

Source§

impl Byteable for LittleEndian<f64>

Source§

impl Byteable for LittleEndian<i8>

Source§

impl Byteable for LittleEndian<i16>

Source§

impl Byteable for LittleEndian<i32>

Source§

impl Byteable for LittleEndian<i64>

Source§

impl Byteable for LittleEndian<i128>

Source§

impl Byteable for LittleEndian<isize>

Source§

impl Byteable for LittleEndian<u8>

Source§

impl Byteable for LittleEndian<u16>

Source§

impl Byteable for LittleEndian<u32>

Source§

impl Byteable for LittleEndian<u64>

Source§

impl Byteable for LittleEndian<u128>

Source§

impl Byteable for LittleEndian<usize>

Source§

impl<Raw, Regular> Byteable for Regular
where Regular: ByteableRegular<Raw = Raw> + Copy, Raw: Byteable,