pub struct FrameHeader { /* private fields */ }
Expand description
Describes an individual frame within a WebSocket message at a low level.
The frame header is a lower level detail of the WebSocket protocol. At the application level,
use Message
structs and the MessageCodec
.
Implementations§
Source§impl FrameHeader
impl FrameHeader
Sourcepub fn new(
fin: bool,
rsv: u8,
opcode: u8,
mask: Option<Mask>,
data_len: DataLength,
) -> Self
pub fn new( fin: bool, rsv: u8, opcode: u8, mask: Option<Mask>, data_len: DataLength, ) -> Self
Returns a FrameHeader
struct.
Sourcepub fn fin(&self) -> bool
pub fn fin(&self) -> bool
Returns the WebSocket FIN bit, which indicates that this is the last frame in the message.
Sourcepub fn rsv(&self) -> u8
pub fn rsv(&self) -> u8
Returns the WebSocket RSV1, RSV2 and RSV3 bits.
The RSV bits may be used by extensions to the WebSocket protocol not exposed by this crate.
Sourcepub fn opcode(&self) -> u8
pub fn opcode(&self) -> u8
Returns the WebSocket opcode, which defines the interpretation of the frame payload data.
Sourcepub fn data_len(&self) -> DataLength
pub fn data_len(&self) -> DataLength
Returns the length of the payload data that follows this header.
Sourcepub fn header_len(&self) -> usize
pub fn header_len(&self) -> usize
Returns the total length of the frame header.
The frame header is between 2 bytes and 10 bytes in length, depending on the presence of a mask and the length of the payload data.
Trait Implementations§
Source§impl Clone for FrameHeader
impl Clone for FrameHeader
Source§fn clone(&self) -> FrameHeader
fn clone(&self) -> FrameHeader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more