Trait websocket::ws::dataframe::DataFrame[][src]

pub trait DataFrame {
    pub fn is_last(&self) -> bool;
pub fn opcode(&self) -> u8;
pub fn reserved(&self) -> &[bool; 3];
pub fn size(&self) -> usize;
pub fn write_payload(
        &self,
        socket: &mut dyn Write
    ) -> Result<(), WebSocketError>;
pub fn take_payload(self) -> Vec<u8, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
; pub fn frame_size(&self, masked: bool) -> usize { ... }
pub fn write_to(
        &self,
        writer: &mut dyn Write,
        mask: bool
    ) -> Result<(), WebSocketError> { ... } }

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]

Write the payload to a writer

pub fn take_payload(self) -> Vec<u8, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

Takes the payload out into a vec

Loading content...

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]

Writes a DataFrame to a Writer.

Loading content...

Implementors

impl DataFrame for OwnedMessage[src]

impl DataFrame for DataFrame[src]

impl<'a> DataFrame for Message<'a>[src]

Loading content...