Struct FrameHeader

struct FrameHeader { ... }

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

impl FrameHeader

fn parse<impl AsRef<[u8]>: AsRef<[u8]>>(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.

fn len(self: &Self, length: u64) -> usize

Get the size of the header formatted with given payload length.

fn format<impl Write: Write>(self: &Self, length: u64, output: &mut impl Write) -> Result<()>

Format a header for given payload size.

impl Clone for FrameHeader

fn clone(self: &Self) -> FrameHeader

impl Debug for FrameHeader

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl Default for FrameHeader

fn default() -> Self

impl Eq for FrameHeader

impl Freeze for FrameHeader

impl PartialEq for FrameHeader

fn eq(self: &Self, other: &FrameHeader) -> bool

impl RefUnwindSafe for FrameHeader

impl Send for FrameHeader

impl StructuralPartialEq for FrameHeader

impl Sync for FrameHeader

impl Unpin for FrameHeader

impl UnsafeUnpin for FrameHeader

impl UnwindSafe for FrameHeader

impl<T> Any for FrameHeader

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for FrameHeader

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for FrameHeader

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for FrameHeader

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for FrameHeader

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Same for FrameHeader

impl<T> ToOwned for FrameHeader

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for FrameHeader

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for FrameHeader

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for FrameHeader

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<V, T> VZip for FrameHeader

fn vzip(self: Self) -> V