Struct tokio_serde_cbor::Codec
[−]
[src]
pub struct Codec<Dec, Enc> { /* fields omitted */ }
Methods
impl<'de, Dec: Deserialize<'de>, Enc: Serialize> Codec<Dec, Enc>
[src]
fn new() -> Self
Creates a new codec
fn sd(self, sd: SdMode) -> Self
Turns the internal encoder into one with confifured self-describe behaviour.
fn packed(self, packed: bool) -> Self
Turns the internal encoder into one with configured packed encoding.
If packed
is true, it omits the field names from the encoded data. That makes it smaller,
but it also means the decoding end must know the exact order of fields and it can't be
something like python, which would want to get a dictionary out of it.
Trait Implementations
impl<Dec: Clone, Enc: Clone> Clone for Codec<Dec, Enc>
[src]
fn clone(&self) -> Codec<Dec, Enc>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<Dec: Debug, Enc: Debug> Debug for Codec<Dec, Enc>
[src]
impl<'de, Dec: Deserialize<'de>, Enc: Serialize> Default for Codec<Dec, Enc>
[src]
impl<'de, Dec: Deserialize<'de>, Enc: Serialize> IoDecoder for Codec<Dec, Enc>
[src]
type Item = Dec
The type of decoded frames.
type Error = CborError
The type of unrecoverable frame decoding errors. Read more
fn decode(&mut self, src: &mut BytesMut) -> Result<Option<Dec>, CborError>
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>
&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