Struct ws::Frame
[−]
[src]
pub struct Frame { /* fields omitted */ }
A struct representing a WebSocket frame.
Methods
impl Frame
[src]
fn len(&self) -> usize
Get the length of the frame. This is the length of the header + the length of the payload.
fn is_final(&self) -> bool
Test whether the frame is a final frame.
fn has_rsv1(&self) -> bool
Test whether the first reserved bit is set.
fn has_rsv2(&self) -> bool
Test whether the second reserved bit is set.
fn has_rsv3(&self) -> bool
Test whether the third reserved bit is set.
fn opcode(&self) -> OpCode
Get the OpCode of the frame.
fn is_control(&self) -> bool
Test whether this is a control frame.
fn payload(&self) -> &Vec<u8>
Get a reference to the frame's payload.
fn set_final(&mut self, is_final: bool) -> &mut Frame
Make this frame a final frame.
fn set_rsv1(&mut self, has_rsv1: bool) -> &mut Frame
Set the first reserved bit.
fn set_rsv2(&mut self, has_rsv2: bool) -> &mut Frame
Set the second reserved bit.
fn set_rsv3(&mut self, has_rsv3: bool) -> &mut Frame
Set the third reserved bit.
fn set_opcode(&mut self, opcode: OpCode) -> &mut Frame
Set the OpCode.
fn payload_mut(&mut self) -> &mut Vec<u8>
Edit the frame's payload.
fn into_data(self) -> Vec<u8>
Consume the frame into its payload.
fn message(data: Vec<u8>, code: OpCode, finished: bool) -> Frame
Create a new data frame.
fn pong(data: Vec<u8>) -> Frame
Create a new Pong control frame.
fn ping(data: Vec<u8>) -> Frame
Create a new Ping control frame.
fn close(code: CloseCode, reason: &str) -> Frame
Create a new Close control frame.
fn parse(cursor: &mut Cursor<Vec<u8>>) -> Result<Option<Frame>>
Parse the input stream into a frame.
fn format<W>(&mut self, w: &mut W) -> Result<()> where
W: Write,
W: Write,
Write a frame out to a buffer
Trait Implementations
impl Debug for Frame
[src]
impl Clone for Frame
[src]
fn clone(&self) -> Frame
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more