Trait websocket::ws::dataframe::DataFrame [−][src]
A generic DataFrame. Every dataframe should be able to provide these methods. (If the payload is not known in advance then rewrite the write_payload method)
Required methods
pub fn is_last(&self) -> bool
[src]
Is this dataframe the final dataframe of the message?
pub fn opcode(&self) -> u8
[src]
What type of data does this dataframe contain?
pub fn reserved(&self) -> &[bool; 3]
[src]
Reserved bits of this dataframe
pub fn size(&self) -> usize
[src]
How long (in bytes) is this dataframe’s payload
pub fn write_payload(
&self,
socket: &mut dyn Write
) -> Result<(), WebSocketError>
[src]
&self,
socket: &mut dyn Write
) -> Result<(), WebSocketError>
Write the payload to a writer
pub fn take_payload(self) -> Vec<u8, Global>ⓘ
[src]
Takes the payload out into a vec
Provided methods
pub fn frame_size(&self, masked: bool) -> usize
[src]
Get’s the size of the entire dataframe in bytes, i.e. header and payload.
pub fn write_to(
&self,
writer: &mut dyn Write,
mask: bool
) -> Result<(), WebSocketError>
[src]
&self,
writer: &mut dyn Write,
mask: bool
) -> Result<(), WebSocketError>
Writes a DataFrame to a Writer.
Implementors
impl DataFrame for OwnedMessage
[src]
pub fn is_last(&self) -> bool
[src]
pub fn opcode(&self) -> u8
[src]
pub fn reserved(&self) -> &[bool; 3]
[src]
pub fn size(&self) -> usize
[src]
pub fn write_payload(
&self,
socket: &mut dyn Write
) -> Result<(), WebSocketError>
[src]
&self,
socket: &mut dyn Write
) -> Result<(), WebSocketError>
pub fn take_payload(self) -> Vec<u8, Global>ⓘ
[src]
impl DataFrame for DataFrame
[src]
pub fn is_last(&self) -> bool
[src]
pub fn opcode(&self) -> u8
[src]
pub fn reserved(&self) -> &[bool; 3]
[src]
pub fn size(&self) -> usize
[src]
pub fn write_payload(
&self,
socket: &mut dyn Write
) -> Result<(), WebSocketError>
[src]
&self,
socket: &mut dyn Write
) -> Result<(), WebSocketError>