[−][src]Struct websocket::codec::ws::DataFrameCodec
A codec for decoding and encoding websocket dataframes.
This codec decodes dataframes into the crates default implementation
of Dataframe
but can encode and send any struct that implements the
ws::Dataframe
trait. The type of struct to encode is given by the D
type parameter in the struct.
Using dataframes directly is meant for users who want low-level access to the
connection. If you don't want to do anything low-level please use the
MessageCodec
codec instead, or better yet use the ClientBuilder
to make
clients and the Server
to make servers.
Methods
impl DataFrameCodec<DataFrame>
[src]
impl DataFrameCodec<DataFrame>
pub fn default(context: Context) -> Self
[src]
pub fn default(context: Context) -> Self
Create a new DataFrameCodec
struct using the crate's implementation
of dataframes for reading and writing dataframes.
Use this method if you don't want to provide a custom implementation for your dataframes.
impl<D> DataFrameCodec<D>
[src]
impl<D> DataFrameCodec<D>
pub fn new(context: Context) -> DataFrameCodec<D>
[src]
pub fn new(context: Context) -> DataFrameCodec<D>
Create a new DataFrameCodec
struct using any implementation of
ws::Dataframe
you want. This is useful if you want to manipulate
the websocket layer very specifically.
If you only want to be able to send and receive the crate's
DataFrame
struct use .default(Context)
instead.
Trait Implementations
impl<D> Decoder for DataFrameCodec<D>
[src]
impl<D> Decoder for DataFrameCodec<D>
type Item = DataFrame
The type of decoded frames.
type Error = WebSocketError
The type of unrecoverable frame decoding errors. Read more
fn decode(
&mut self,
src: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
[src]
fn decode(
&mut self,
src: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
Attempts to decode a frame from the provided buffer of bytes. Read more
fn decode_eof(
&mut self,
buf: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
[src]
fn decode_eof(
&mut self,
buf: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
A default method available to be called when there are no more bytes available to be read from the underlying I/O. Read more
fn framed<T>(self, io: T) -> Framed<T, Self> where
Self: Encoder,
T: AsyncRead + AsyncWrite,
[src]
fn framed<T>(self, io: T) -> Framed<T, Self> where
Self: Encoder,
T: AsyncRead + AsyncWrite,
Provides a Stream
and Sink
interface for reading and writing to this Io
object, using Decode
and Encode
to read and write the raw data. Read more
impl<D> Encoder for DataFrameCodec<D> where
D: Borrow<dyn DataFrameTrait>,
[src]
impl<D> Encoder for DataFrameCodec<D> where
D: Borrow<dyn DataFrameTrait>,
Auto Trait Implementations
impl<D> Send for DataFrameCodec<D> where
D: Send,
impl<D> Send for DataFrameCodec<D> where
D: Send,
impl<D> Sync for DataFrameCodec<D> where
D: Sync,
impl<D> Sync for DataFrameCodec<D> where
D: Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
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]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
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]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T> Typeable for T where
T: Any,
[src]
impl<T> Typeable for T where
T: Any,
impl<T> Erased for T
[src]
impl<T> Erased for T