pub struct FrameHeader {
pub is_final: bool,
pub rsv1: bool,
pub rsv2: bool,
pub rsv3: bool,
pub opcode: OpCode,
pub mask: Option<[u8; 4]>,
}
Expand description
A struct representing a WebSocket frame header.
Fields§
§is_final: bool
Indicates that the frame is the last one of a possibly fragmented message.
rsv1: bool
Reserved for protocol extensions.
rsv2: bool
Reserved for protocol extensions.
rsv3: bool
Reserved for protocol extensions.
opcode: OpCode
WebSocket protocol opcode.
mask: Option<[u8; 4]>
A frame mask, if any.
Implementations§
Source§impl FrameHeader
impl FrameHeader
Sourcepub fn parse(
cursor: &mut Cursor<impl AsRef<[u8]>>,
) -> Result<Option<(Self, u64)>>
pub fn parse( cursor: &mut Cursor<impl AsRef<[u8]>>, ) -> Result<Option<(Self, u64)>>
Parse a header from an input stream.
Returns None
if insufficient data and does not consume anything in this case.
Payload size is returned along with the header.
Trait Implementations§
Source§impl Clone for FrameHeader
impl Clone for FrameHeader
Source§fn clone(&self) -> FrameHeader
fn clone(&self) -> FrameHeader
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 FrameHeader
impl Debug for FrameHeader
Source§impl Default for FrameHeader
impl Default for FrameHeader
Source§impl PartialEq for FrameHeader
impl PartialEq for FrameHeader
impl Eq for FrameHeader
impl StructuralPartialEq for FrameHeader
Auto Trait Implementations§
impl Freeze for FrameHeader
impl RefUnwindSafe for FrameHeader
impl Send for FrameHeader
impl Sync for FrameHeader
impl Unpin for FrameHeader
impl UnwindSafe for FrameHeader
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)