Command

Trait Command 

Source
pub trait Command {
    const MAX_LENGTH: usize;

    // Required method
    fn to_bytes<'a>(
        &self,
        buffer: &'a mut [u8],
    ) -> Result<&'a [u8], SerializationError>;
}
Expand description

The core trait for any object that can be serialized into an II-compatible byte message.

Required Associated Constants§

Source

const MAX_LENGTH: usize

The maximum number of bytes this command could possibly serialize to. This helps the user create a buffer of the correct size.

Required Methods§

Source

fn to_bytes<'a>( &self, buffer: &'a mut [u8], ) -> Result<&'a [u8], SerializationError>

Serializes the command into the provided byte buffer.

On success, it returns a slice of the buffer containing only the written bytes.

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 Command for mii::devices::ansible::Commands

Source§

const MAX_LENGTH: usize = 4usize

Source§

impl Command for mii::devices::er301::Commands

Source§

const MAX_LENGTH: usize = 4usize

Source§

impl Command for mii::devices::just_friends::Commands

Source§

const MAX_LENGTH: usize = 6usize

Source§

impl Command for mii::devices::telexo::Commands

Source§

const MAX_LENGTH: usize = 4usize