Trait Struct

Source
pub trait Struct {
    type ImplType;

    // Required methods
    fn write_to<T: MutBits>(&self, out: &mut T) -> Result<(), Error>;
    fn parse_from<T: Bits>(input: &mut T) -> Result<Self::ImplType, Error>;
}
Expand description

A struct is a series of bytes in memory, serialized in the order that the fields are present in the struct.

Generally speaking, you shouldn’t need to implement this, unless you need some custom encoding. It’s intended to be used with irox_structs_derive to automatically generate the impl.

Required Associated Types§

Required Methods§

Source

fn write_to<T: MutBits>(&self, out: &mut T) -> Result<(), Error>

Write the encoding of the type to the specified output buffer

Source

fn parse_from<T: Bits>(input: &mut T) -> Result<Self::ImplType, Error>

Parses and creates the impl type from the input stream, consuming bytes along the way.

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§