Struct tokio_jsoncodec::Codec [−][src]
pub struct Codec<D, E> { /* fields omitted */ }
JSON-based codec.
Methods
impl<D, E> Codec<D, E>
[src]
impl<D, E> Codec<D, E>
pub fn new(pretty: bool) -> Self
[src]
pub fn new(pretty: bool) -> Self
Creates a new Codec
.
pretty
controls whether or not encoded values are pretty-printed.
pub fn pretty(&mut self, pretty: bool)
[src]
pub fn pretty(&mut self, pretty: bool)
Set whether or not encoded values are pretty-printed.
Trait Implementations
impl<D: Clone, E: Clone> Clone for Codec<D, E>
[src]
impl<D: Clone, E: Clone> Clone for Codec<D, E>
fn clone(&self) -> Codec<D, E>
[src]
fn clone(&self) -> Codec<D, E>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl<D: Debug, E: Debug> Debug for Codec<D, E>
[src]
impl<D: Debug, E: Debug> Debug for Codec<D, E>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<D, E> Default for Codec<D, E>
[src]
impl<D, E> Default for Codec<D, E>
impl<D, E> Decoder for Codec<D, E> where
D: Deserialize<'de>,
[src]
impl<D, E> Decoder for Codec<D, E> where
D: Deserialize<'de>,
type Item = D
The type of decoded frames.
type Error = Error
The type of unrecoverable frame decoding errors. Read more
fn decode(&mut self, src: &mut BytesMut) -> Result<Option<D>, Error>
[src]
fn decode(&mut self, src: &mut BytesMut) -> Result<Option<D>, 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, E> Encoder for Codec<D, E> where
E: Serialize,
[src]
impl<D, E> Encoder for Codec<D, E> where
E: Serialize,