pub struct Codec<Dec, Enc> { /* private fields */ }
Implementations§
Source§impl<'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§
Source§impl<'de, Dec: Deserialize<'de>, Enc: Serialize> Decoder for Codec<Dec, Enc>
impl<'de, Dec: Deserialize<'de>, Enc: Serialize> Decoder for Codec<Dec, Enc>
Source§fn 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
Auto Trait Implementations§
impl<Dec, Enc> Freeze for Codec<Dec, Enc>
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more