[−][src]Struct websocket_base::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]
pub fn default(context: Context) -> Self
[src]
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]
pub fn new(context: Context) -> DataFrameCodec<D>
[src]
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> Encoder for DataFrameCodec<D> where
D: Borrow<dyn DataFrameTrait>,
[src]
D: Borrow<dyn DataFrameTrait>,
type Item = D
The type of items consumed by the Encoder
type Error = WebSocketError
The type of encoding errors. Read more
fn encode(
&mut self,
item: Self::Item,
dst: &mut BytesMut
) -> Result<(), Self::Error>
[src]
&mut self,
item: Self::Item,
dst: &mut BytesMut
) -> Result<(), Self::Error>
impl<D> Decoder for DataFrameCodec<D>
[src]
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]
&mut self,
src: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
fn decode_eof(
&mut self,
buf: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
[src]
&mut self,
buf: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
fn framed<T>(self, io: T) -> Framed<T, Self> where
Self: Encoder,
T: AsyncRead + AsyncWrite,
[src]
Self: Encoder,
T: AsyncRead + AsyncWrite,
Auto Trait Implementations
impl<D> Send for DataFrameCodec<D> where
D: Send,
D: Send,
impl<D> Sync for DataFrameCodec<D> where
D: Sync,
D: Sync,
impl<D> Unpin for DataFrameCodec<D> where
D: Unpin,
D: Unpin,
impl<D> UnwindSafe for DataFrameCodec<D> where
D: UnwindSafe,
D: UnwindSafe,
impl<D> RefUnwindSafe for DataFrameCodec<D> where
D: RefUnwindSafe,
D: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,