Skip to main content

PacketComponents

Trait PacketComponents 

Source
pub trait PacketComponents:
    Debug
    + Hash
    + Eq
    + Sized {
    // Required methods
    fn values(&self) -> (u16, u16);
    fn from_values(component: u16, command: u16, notify: bool) -> Option<Self>;

    // Provided method
    fn from_header(header: &PacketHeader) -> Option<Self> { ... }
}
Expand description

Trait implemented by structures that can be used as packet components

Required Methods§

Source

fn values(&self) -> (u16, u16)

Converts the packet component into the ID of the component, and command

Source

fn from_values(component: u16, command: u16, notify: bool) -> Option<Self>

Decodes the packet component using the provided component id, command id, and whether the packet is a notify packet

component The packet component command The packet command notify Whether the packet is a notify packet

Provided Methods§

Source

fn from_header(header: &PacketHeader) -> Option<Self>

Decodes the packet component using the details stored in the provided packet header

header The packet header to decode from

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§