[][src]Trait byte_struct::ByteStruct

pub trait ByteStruct: ByteStructLen {
    fn write_bytes(&self, bytes: &mut [u8]);
fn read_bytes(bytes: &[u8]) -> Self; }

A data structure that can be packed into or unpacked from raw bytes.

This trait can be derived by #[derive(ByteStruct)].

One can implement this trait for custom types in order to pack or unpack an object in a special way.

Required methods

fn write_bytes(&self, bytes: &mut [u8])

Packs the struct into raw bytes and write to a slice

fn read_bytes(bytes: &[u8]) -> Self

Unpacks raw bytes from a slice into a new struct

Loading content...

Implementors

Loading content...