Struct tungstenite::protocol::frame::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 header(&self) -> &FrameHeader[src]
pub fn header(&self) -> &FrameHeaderGet a reference to the frame's header.
pub fn header_mut(&mut self) -> &mut FrameHeader[src]
pub fn header_mut(&mut self) -> &mut FrameHeaderGet 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) -> 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(msg: Option<CloseFrame>) -> Frame[src]
pub fn close(msg: Option<CloseFrame>) -> FrameCreate 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>) -> SelfCreate 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
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)1.0.0
[src]Performs copy-assignment from source. Read more
impl Display for Frame[src]
impl Display for Frame