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 struct field is ignored.

Deserializer supports self-describing formats (deserialize_any).

Deserializer deserializes structs from both MessagePack maps or arrays using both uint or str 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§

Modules§

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