Enum lightws::frame::length::PayloadLen
source · pub enum PayloadLen {
Standard(u8),
Extended1(u16),
Extended2(u64),
}
Expand description
Payload length.
Could be 7 bits, 7+16 bits, or 7+64 bits.
Variants§
Implementations§
source§impl PayloadLen
impl PayloadLen
sourcepub const fn from_flag(b: u8) -> Self
pub const fn from_flag(b: u8) -> Self
Read the flag which indicates the kind of length.
If extended length is used, the caller should read the next 2 or 8 bytes to get the real length.
sourcepub const fn to_flag(&self) -> u8
pub const fn to_flag(&self) -> u8
Generate the flag byte.
If length <= 125
, it represents the real length.
sourcepub const fn from_byte2(buf: [u8; 2]) -> Self
pub const fn from_byte2(buf: [u8; 2]) -> Self
Read as 16-bit length.
sourcepub const fn from_byte8(buf: [u8; 8]) -> Self
pub const fn from_byte8(buf: [u8; 8]) -> Self
Read as 64-bit length.
Trait Implementations§
source§impl Clone for PayloadLen
impl Clone for PayloadLen
source§fn clone(&self) -> PayloadLen
fn clone(&self) -> PayloadLen
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for PayloadLen
impl Debug for PayloadLen
source§impl PartialEq for PayloadLen
impl PartialEq for PayloadLen
source§fn eq(&self, other: &PayloadLen) -> bool
fn eq(&self, other: &PayloadLen) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for PayloadLen
impl Eq for PayloadLen
impl StructuralEq for PayloadLen
impl StructuralPartialEq for PayloadLen
Auto Trait Implementations§
impl RefUnwindSafe for PayloadLen
impl Send for PayloadLen
impl Sync for PayloadLen
impl Unpin for PayloadLen
impl UnwindSafe for PayloadLen
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