Crate ser_write_msgpack

Source
Expand description

A MessagePack serde serializer for ser-write and a deserializer for convenience.

Serializer types:

Serde type ->MessagePack type
()nil
Unit structnil
boolbool
NewType(T)T -> MessagePack
Nonenil
Some(T)T -> MessagePack
u8-u64uint (smallest representation)
i8-i64int, uint (sm. repr.)
f23float-32
f64float-64
strstr
bytesbin
array, tuplearray (sm. repr.)
seq-likearray (sm. repr.)
map-likemap (sm. repr.)
structmap or array (depending on implementation)
unit variantstr or uint (depending on implementation)
newtype variantfixmap:1 variant, T (variant: str or uint impl. dep.)
tuple variantfixmap:1 variant, array (impl. dep.)
struct variantfixmap:1 variant, struct (impl. dep.)

Currently neither Serializer nor Deserializer supports MessagePack extension types. The ext and fixext types are properly recognized and skipped over when a value ignored.

  • Deserializer supports self-describing formats (deserialize_any).
  • Deserializer deserializes structs from MessagePack maps or arrays using both uint or str MessagePack types as field identifiers.

Deserializer types:

MessagePack type ->Serde type (depending on context)
nilunit,none,NaN
boolbool
fixint, intf64,f32,u8-u64,i8-i64
float-32f64 or f32
float-64f64 or f32
strstr, enum variant, field name
binbytes (&[u8], Vec<u8> with std or alloc)
arrayarray,tuple,tuple struct,typle variant,seq-like,struct
mapenum variant,struct variant,map-like,struct
TNewType(T), Some(T)
fixext, extUnsupported

Re-exports§

pub use ser::to_vec_compact;
pub use ser::to_vec;
pub use ser::to_vec_named;
pub use ser::to_writer_compact;
pub use ser::to_writer;
pub use ser::to_writer_named;
pub use de::from_slice;
pub use de::from_slice_split_tail;
pub use ser_write;

Modules§

de
MessagePack serde deserializer
ser
MessagePack serde serializer for ser-write

Traits§

SerWrite
Serializers should write data to the implementations of this trait.