pub struct Header {
pub typ: PacketType,
pub dup: bool,
pub qos: QoS,
pub retain: bool,
pub remaining_len: u32,
}
Expand description
Fixed header type.
Fields§
§typ: PacketType
§dup: bool
§qos: QoS
§retain: bool
§remaining_len: u32
Implementations§
Source§impl Header
impl Header
pub fn new( typ: PacketType, dup: bool, qos: QoS, retain: bool, remaining_len: u32, ) -> Self
pub fn new_with(hd: u8, remaining_len: u32) -> Result<Header, ErrorV5>
pub fn decode(reader: &[u8]) -> Result<Self, ErrorV5>
pub async fn decode_async<T: AsyncRead + Unpin>( reader: &mut T, ) -> Result<Self, ErrorV5>
Trait Implementations§
Source§impl PollHeader for Header
impl PollHeader for Header
type Error = ErrorV5
type Packet = Packet
fn new_with(hd: u8, remaining_len: u32) -> Result<Self, Self::Error>where
Self: Sized,
Source§fn build_empty_packet(&self) -> Option<Self::Packet>
fn build_empty_packet(&self) -> Option<Self::Packet>
Packet without body is empty packet
fn block_decode(self, reader: &mut &[u8]) -> Result<Self::Packet, Self::Error>
fn remaining_len(&self) -> usize
fn is_eof_error(err: &Self::Error) -> bool
impl Copy for Header
impl Eq for Header
impl StructuralPartialEq for Header
Auto Trait Implementations§
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more