Struct tokio_serde_cbor::Codec
source · [−]pub struct Codec<Dec, Enc> { /* private fields */ }
Implementations
sourceimpl<'de, Dec: Deserialize<'de>, Enc: Serialize> Codec<Dec, Enc>
impl<'de, Dec: Deserialize<'de>, Enc: Serialize> Codec<Dec, Enc>
sourcepub fn sd(self, sd: SdMode) -> Self
pub fn sd(self, sd: SdMode) -> Self
Turns the internal encoder into one with confifured self-describe behaviour.
sourcepub fn packed(self, packed: bool) -> Self
pub 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
sourceimpl<'de, Dec: Deserialize<'de>, Enc: Serialize> Decoder for Codec<Dec, Enc>
impl<'de, Dec: Deserialize<'de>, Enc: Serialize> Decoder for Codec<Dec, Enc>
type Item = Dec
type Item = Dec
The type of decoded frames.
sourcefn decode(&mut self, src: &mut BytesMut) -> Result<Option<Dec>, Error>
fn decode(&mut self, src: &mut BytesMut) -> Result<Option<Dec>, Error>
Attempts to decode a frame from the provided buffer of bytes. Read more
sourceimpl<'de, Dec: Deserialize<'de>, Enc: Serialize> Default for Codec<Dec, Enc>
impl<'de, Dec: Deserialize<'de>, Enc: Serialize> Default for Codec<Dec, Enc>
Auto Trait Implementations
impl<Dec, Enc> RefUnwindSafe for Codec<Dec, Enc>
impl<Dec, Enc> Send for Codec<Dec, Enc>
impl<Dec, Enc> Sync for Codec<Dec, Enc>
impl<Dec, Enc> Unpin for Codec<Dec, Enc>
impl<Dec, Enc> UnwindSafe for Codec<Dec, Enc>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more