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§
Required Methods§
Sourcefn from_bytes(bytes: Bytes<'_>) -> Result<Self>
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.
fn flags(&self) -> &Flags
fn set_flags(&mut self, flags: Flags)
Sourcefn id(&self) -> u32
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.
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.