pub struct Frame {
pub fin: bool,
pub rsv1: bool,
pub rsv2: bool,
pub rsv3: bool,
pub opcode: OpCode,
pub mask: Option<[u8; 4]>,
pub payload: Vec<u8>,
}
Expand description
Represents a WebSocket frame.
Fields§
§fin: bool
Indicates if this is the final fragment in a message.
rsv1: bool
First reserved bit.
rsv2: bool
Second reserved bit.
rsv3: bool
Third reserved bit.
opcode: OpCode
The opcode for this frame.
mask: Option<[u8; 4]>
The masking key, if any.
payload: Vec<u8>
The payload data.
Implementations§
Source§impl Frame
impl Frame
Sourcepub fn new(opcode: OpCode, payload: Vec<u8>) -> Self
pub fn new(opcode: OpCode, payload: Vec<u8>) -> Self
Creates a new Frame with the given opcode and payload.
Sourcepub fn close(status_code: Option<u16>) -> Self
pub fn close(status_code: Option<u16>) -> Self
Creates a close frame with an optional status code.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin 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