Struct ws::Frame [−][src]
pub struct Frame { /* fields omitted */ }A struct representing a WebSocket frame.
Methods
impl Frame[src]
impl Framepub fn len(&self) -> usize[src]
pub fn len(&self) -> usizeGet the length of the frame. This is the length of the header + the length of the payload.
pub fn is_empty(&self) -> bool[src]
pub fn is_empty(&self) -> boolReturn false: a frame is never empty since it has a header.
pub fn is_final(&self) -> bool[src]
pub fn is_final(&self) -> boolTest whether the frame is a final frame.
pub fn has_rsv1(&self) -> bool[src]
pub fn has_rsv1(&self) -> boolTest whether the first reserved bit is set.
pub fn has_rsv2(&self) -> bool[src]
pub fn has_rsv2(&self) -> boolTest whether the second reserved bit is set.
pub fn has_rsv3(&self) -> bool[src]
pub fn has_rsv3(&self) -> boolTest whether the third reserved bit is set.
pub fn opcode(&self) -> OpCode[src]
pub fn opcode(&self) -> OpCodeGet the OpCode of the frame.
pub fn is_control(&self) -> bool[src]
pub fn is_control(&self) -> boolTest whether this is a control frame.
pub fn payload(&self) -> &Vec<u8>[src]
pub fn payload(&self) -> &Vec<u8>Get a reference to the frame's payload.
pub fn set_final(&mut self, is_final: bool) -> &mut Frame[src]
pub fn set_final(&mut self, is_final: bool) -> &mut FrameMake this frame a final frame.
pub fn set_rsv1(&mut self, has_rsv1: bool) -> &mut Frame[src]
pub fn set_rsv1(&mut self, has_rsv1: bool) -> &mut FrameSet the first reserved bit.
pub fn set_rsv2(&mut self, has_rsv2: bool) -> &mut Frame[src]
pub fn set_rsv2(&mut self, has_rsv2: bool) -> &mut FrameSet the second reserved bit.
pub fn set_rsv3(&mut self, has_rsv3: bool) -> &mut Frame[src]
pub fn set_rsv3(&mut self, has_rsv3: bool) -> &mut FrameSet the third reserved bit.
pub fn set_opcode(&mut self, opcode: OpCode) -> &mut Frame[src]
pub fn set_opcode(&mut self, opcode: OpCode) -> &mut FrameSet the OpCode.
pub fn payload_mut(&mut self) -> &mut Vec<u8>[src]
pub fn payload_mut(&mut self) -> &mut Vec<u8>Edit the frame's payload.
pub fn into_data(self) -> Vec<u8>[src]
pub fn into_data(self) -> Vec<u8>Consume the frame into its payload.
pub fn message(data: Vec<u8>, code: OpCode, finished: bool) -> Frame[src]
pub fn message(data: Vec<u8>, code: OpCode, finished: bool) -> FrameCreate a new data frame.
pub fn pong(data: Vec<u8>) -> Frame[src]
pub fn pong(data: Vec<u8>) -> FrameCreate a new Pong control frame.
pub fn ping(data: Vec<u8>) -> Frame[src]
pub fn ping(data: Vec<u8>) -> FrameCreate a new Ping control frame.
pub fn close(code: CloseCode, reason: &str) -> Frame[src]
pub fn close(code: CloseCode, reason: &str) -> FrameCreate a new Close control frame.
pub fn parse(cursor: &mut Cursor<Vec<u8>>) -> Result<Option<Frame>>[src]
pub fn parse(cursor: &mut Cursor<Vec<u8>>) -> Result<Option<Frame>>Parse the input stream into a frame.
pub fn format<W>(&mut self, w: &mut W) -> Result<()> where
W: Write, [src]
pub fn format<W>(&mut self, w: &mut W) -> Result<()> where
W: Write, Write a frame out to a buffer
Trait Implementations
impl Debug for Frame[src]
impl Debug for Framefn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Clone for Frame[src]
impl Clone for Framefn clone(&self) -> Frame[src]
fn clone(&self) -> FrameReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Default for Frame[src]
impl Default for Frameimpl Display for Frame[src]
impl Display for Frame