pub struct CborCodec;Expand description
A codec that serializes values to and from CBOR.
CBOR is a compact, self-describing binary format, which makes it the default
choice for constrained devices and metered radio links where every byte costs
power or money. The codec works for any type that implements serde::Serialize
and serde::de::DeserializeOwned.
§Examples
use pamoja_codec::{CborCodec, Codec};
let codec = CborCodec;
let value = (1u8, "ok".to_owned());
let encoded = codec.encode(&value).unwrap();
let decoded: (u8, String) = codec.decode(&encoded).unwrap();
assert_eq!(decoded, value);Trait Implementations§
impl Copy for CborCodec
Auto Trait Implementations§
impl Freeze for CborCodec
impl RefUnwindSafe for CborCodec
impl Send for CborCodec
impl Sync for CborCodec
impl Unpin for CborCodec
impl UnsafeUnpin for CborCodec
impl UnwindSafe for CborCodec
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