pub trait PacketHeader: Clone + Sized {
    const LEN: u32;

    // Required methods
    fn from_bytes(bytes: Bytes<'_>) -> Result<Self>;
    fn body_len(&self) -> u32;
    fn flags(&self) -> &Flags;
    fn set_flags(&mut self, flags: Flags);
    fn id(&self) -> u32;
    fn set_id(&mut self, id: u32);
}

Required Associated Constants§

source

const LEN: u32

how long is the header written to bytes

Required Methods§

source

fn from_bytes(bytes: Bytes<'_>) -> Result<Self>

bytes.len() == Self::LEN

Implementor

If an Error get’s returned this means that the stream from where the bytes are read will be terminated.

source

fn body_len(&self) -> u32

Returns the length of the body

source

fn flags(&self) -> &Flags

source

fn set_flags(&mut self, flags: Flags)

source

fn id(&self) -> u32

Returns the internal flags.

Note

This is returned as a number so that outside of this crate nobody can rely on the information contained within.

source

fn set_id(&mut self, id: u32)

Object Safety§

This trait is not object safe.

Implementors§