Trait PacketHeader

Source
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)

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.

Implementors§