[−][src]Struct tungstenite::protocol::frame::Frame
A struct representing a WebSocket frame.
Methods
impl Frame
[src]
pub fn len(&self) -> usize
[src]
Get the length of the frame. This is the length of the header + the length of the payload.
pub fn header(&self) -> &FrameHeader
[src]
Get a reference to the frame's header.
pub fn header_mut(&mut self) -> &mut FrameHeader
[src]
Get a mutable reference to the frame's header.
pub fn payload(&self) -> &Vec<u8>
[src]
Get a reference to the frame's payload.
pub fn payload_mut(&mut self) -> &mut Vec<u8>
[src]
Get a mutable reference to the frame's payload.
pub fn into_data(self) -> Vec<u8>
[src]
Consume the frame into its payload as binary.
pub fn into_string(self) -> StdResult<String, FromUtf8Error>
[src]
Consume the frame into its payload as string.
pub fn message(data: Vec<u8>, opcode: OpCode, is_final: bool) -> Frame
[src]
Create a new data frame.
pub fn pong(data: Vec<u8>) -> Frame
[src]
Create a new Pong control frame.
pub fn ping(data: Vec<u8>) -> Frame
[src]
Create a new Ping control frame.
pub fn close(msg: Option<CloseFrame>) -> Frame
[src]
Create a new Close control frame.
pub fn from_payload(header: FrameHeader, payload: Vec<u8>) -> Self
[src]
Create a frame from given header and data.
pub fn format(
self,
output: &mut impl Write
) -> Result<()>
[src]
self,
output: &mut impl Write
) -> Result<()>
Write a frame out to a buffer
Trait Implementations
impl Clone for Frame
[src]
fn clone(&self) -> Frame
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Frame
[src]
impl Display for Frame
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
impl<T> Same for T
type Output = T
Should always be Self