Skip to main content

Packet

Trait Packet 

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

A packet’s payload as bytes and back — every Schema type is one.

Required Methods§

Source

fn to_payload(&self) -> Vec<u8> ⓘ

Source

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

None for bytes that aren’t this packet.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<T> Packet for T
where T: Schema,