Skip to main content

Packet

Trait Packet 

Source
pub trait Packet: Sized {
    // Required methods
    fn encode(&self) -> Vec<u8> ;
    fn decode(bytes: &[u8]) -> Option<Self>;
}
Expand description

A typed packet that can be encoded to / decoded from a raw byte buffer.

Implement this trait via the packet! macro — do not implement manually.

Required Methods§

Source

fn encode(&self) -> Vec<u8>

Source

fn decode(bytes: &[u8]) -> Option<Self>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§