pub trait Packet<B>: Sizedwhere
    B: PacketBytes,{
    type Header: PacketHeader;

    // Required methods
    fn header(&self) -> &Self::Header;
    fn header_mut(&mut self) -> &mut Self::Header;
    fn empty() -> Self;
    fn from_bytes_and_header(bytes: B, header: Self::Header) -> Result<Self>;
    fn into_bytes(self) -> B;
}

Required Associated Types§

Required Methods§

source

fn header(&self) -> &Self::Header

source

fn header_mut(&mut self) -> &mut Self::Header

source

fn empty() -> Self

Returns an empty header this is used internally by this crate.

Important

body_len needs to return 0

source

fn from_bytes_and_header(bytes: B, header: Self::Header) -> Result<Self>

The bytes.body() length should always be the same value has header.body_len()

source

fn into_bytes(self) -> B

Object Safety§

This trait is not object safe.

Implementors§