pub struct Frame {
pub fin: bool,
pub rsv1: bool,
pub rsv2: bool,
pub rsv3: bool,
pub opcode: Opcode,
pub masking_key: Option<[u8; 4]>,
pub payload: Vec<u8>,
}Expand description
WebSocket-Frame — RFC 6455 §5.2.
Fields§
§fin: boolSpec §5.2 — FIN bit. Final fragment indicator.
rsv1: boolSpec §5.2 — RSV1 bit. MUST be 0 unless extension negotiated.
rsv2: boolSpec §5.2 — RSV2 bit.
rsv3: boolSpec §5.2 — RSV3 bit.
opcode: OpcodeSpec §5.2 — Opcode.
masking_key: Option<[u8; 4]>Spec §5.2 — Masking-Key (Some wenn MASK=1; immer Some von
client→server).
payload: Vec<u8>Spec §5.2 — Payload (already unmasked beim Decode; wird beim
Encode automatisch maskiert wenn masking_key gesetzt).
Implementations§
Source§impl Frame
impl Frame
Sourcepub const fn binary(payload: Vec<u8>) -> Self
pub const fn binary(payload: Vec<u8>) -> Self
Konstruiert einen unmaskierten Binary-Frame mit FIN=1.
Sourcepub const fn ping(payload: Vec<u8>) -> Self
pub const fn ping(payload: Vec<u8>) -> Self
Konstruiert einen Ping-Frame (FIN=1, max. 125 Bytes Payload — Spec §5.5).
Sourcepub const fn pong(payload: Vec<u8>) -> Self
pub const fn pong(payload: Vec<u8>) -> Self
Konstruiert einen Pong-Frame (Spec §5.5.3 — als Reply-zu-Ping MUST denselben Payload haben).
Trait Implementations§
impl Eq for Frame
impl StructuralPartialEq for Frame
Auto Trait Implementations§
impl Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnsafeUnpin for Frame
impl UnwindSafe for Frame
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