Struct tungstenite::protocol::frame::Frame [−][src]
pub struct Frame { /* fields omitted */ }
A struct representing a WebSocket frame.
Methods
impl Frame
[src]
[−]
impl Frame
pub fn len(&self) -> usize
[src]
[−]
pub fn len(&self) -> usize
Get the length of the frame. This is the length of the header + the length of the payload.
pub fn header(&self) -> &FrameHeader
[src]
[−]
pub fn header(&self) -> &FrameHeader
Get a reference to the frame's header.
pub fn header_mut(&mut self) -> &mut FrameHeader
[src]
[−]
pub fn header_mut(&mut self) -> &mut FrameHeader
Get a mutable reference to the frame's header.
pub fn payload(&self) -> &Vec<u8>
[src]
[−]
pub fn payload(&self) -> &Vec<u8>
Get a reference to the frame's payload.
pub fn payload_mut(&mut self) -> &mut Vec<u8>
[src]
[−]
pub fn payload_mut(&mut self) -> &mut Vec<u8>
Get a mutable reference to 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 as binary.
pub fn into_string(self) -> StdResult<String, FromUtf8Error>
[src]
[−]
pub fn into_string(self) -> StdResult<String, FromUtf8Error>
Consume the frame into its payload as string.
pub fn message(data: Vec<u8>, opcode: OpCode, is_final: bool) -> Frame
[src]
[−]
pub fn message(data: Vec<u8>, opcode: OpCode, is_final: bool) -> Frame
Create a new data frame.
pub fn pong(data: Vec<u8>) -> Frame
[src]
[−]
pub fn pong(data: Vec<u8>) -> Frame
Create a new Pong control frame.
pub fn ping(data: Vec<u8>) -> Frame
[src]
[−]
pub fn ping(data: Vec<u8>) -> Frame
Create a new Ping control frame.
pub fn close(msg: Option<CloseFrame>) -> Frame
[src]
[−]
pub fn close(msg: Option<CloseFrame>) -> Frame
Create a new Close control frame.
pub fn from_payload(header: FrameHeader, payload: Vec<u8>) -> Self
[src]
[−]
pub fn from_payload(header: FrameHeader, payload: Vec<u8>) -> Self
Create a frame from given header and data.
pub fn format(
self,
output: &mut impl Write
) -> Result<()>
[src]
[−]
pub fn format(
self,
output: &mut impl Write
) -> Result<()>
Write a frame out to a buffer