Trait IsPacketId

Source
pub trait IsPacketId:
    PrimInt
    + One
    + Bounded
    + Debug
    + Display
    + Hash
    + Eq
    + Serialize
    + 'static {
    type Buffer: AsRef<[u8]> + AsMut<[u8]> + Clone + Default + Eq;

    // Required methods
    fn to_buffer(&self) -> Self::Buffer;
    fn from_buffer(buf: &[u8]) -> Self;
}
Expand description

Packet ID types with associated buffer operations

Required Associated Types§

Source

type Buffer: AsRef<[u8]> + AsMut<[u8]> + Clone + Default + Eq

Fixed-size buffer type

Required Methods§

Source

fn to_buffer(&self) -> Self::Buffer

Convert packet ID to fixed-size buffer

Source

fn from_buffer(buf: &[u8]) -> Self

Parse packet ID from buffer

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.

Implementations on Foreign Types§

Source§

impl IsPacketId for u16

Source§

type Buffer = [u8; 2]

Source§

fn to_buffer(&self) -> Self::Buffer

Source§

fn from_buffer(buf: &[u8]) -> Self

Source§

impl IsPacketId for u32

Source§

type Buffer = [u8; 4]

Source§

fn to_buffer(&self) -> Self::Buffer

Source§

fn from_buffer(buf: &[u8]) -> Self

Implementors§