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

pub trait DataFrame {
    fn is_last(&self) -> bool;
fn opcode(&self) -> u8;
fn reserved<'a>(&'a self) -> &'a [bool; 3];
fn payload<'a>(&'a self) -> Cow<'a, [u8]>; fn size(&self) -> usize { ... }
fn write_payload<W>(&self, socket: &mut W) -> WebSocketResult<()>
    where
        W: Write
, { ... }
fn write_to<W>(&self, writer: &mut W, mask: bool) -> WebSocketResult<()>
    where
        W: Write
, { ... } }

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

Is this dataframe the final dataframe of the message?

What type of data does this dataframe contain?

Reserved bits of this dataframe

Entire payload of the dataframe. If not known then implement write_payload as that is the actual method used when sending the dataframe over the wire.

Provided Methods

How long (in bytes) is this dataframe's payload

Write the payload to a writer

Writes a DataFrame to a Writer.

Implementations on Foreign Types

impl<'a, D> DataFrame for &'a D where
    D: DataFrame
[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

Implementors