Enum tk_http::websocket::Frame
[−]
[src]
pub enum Frame<'a> { Ping(&'a [u8]), Pong(&'a [u8]), Text(&'a str), Binary(&'a [u8]), Close(u16, &'a str), }
A borrowed frame of websocket data
Variants
Ping(&'a [u8])
Ping mesage
Pong(&'a [u8])
Pong mesage
Text(&'a str)
Text (utf-8) message
Binary(&'a [u8])
Binary message
Close(u16, &'a str)
Close message
Methods
impl<'a> Frame<'a>
[src]
pub fn parse<'x>(
buf: &'x mut Buf,
limit: usize,
masked: bool
) -> Result<Option<(Frame<'x>, usize)>, ErrorEnum>
[src]
buf: &'x mut Buf,
limit: usize,
masked: bool
) -> Result<Option<(Frame<'x>, usize)>, ErrorEnum>
Parse a frame for the specified buffer
Returns a frame and a number of bytes or None if no full frame was
in the buffer. After frame is processes you should use
buf.consume(nbytes)
.
pub fn write(&self, buf: &mut Buf, masked: bool)
[src]
Write a frame into specified buffer
masked
should be true for client socket and false for servers socket
according to the spec
Trait Implementations
impl<'a> From<&'a Packet> for Frame<'a>
[src]
impl<'a> Debug for Frame<'a>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<'a> Clone for Frame<'a>
[src]
fn clone(&self) -> Frame<'a>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a> PartialEq for Frame<'a>
[src]
fn eq(&self, __arg_0: &Frame<'a>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Frame<'a>) -> bool
[src]
This method tests for !=
.