Constant rmp_serde::MSGPACK_EXT_STRUCT_NAME
source · pub const MSGPACK_EXT_STRUCT_NAME: &str = "_ExtStruct";
Expand description
Hack used to serialize MessagePack Extension types.
A special ExtStruct
type is used to represent
extension types. This struct is renamed in serde.
Name of Serde newtype struct to Represent Msgpack’s Ext
Msgpack Ext: Ext(tag, binary)
Serde data model: _ExtStruct((tag, binary))
Example Serde impl for custom type:
ⓘ
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename = "_ExtStruct")]
struct ExtStruct((i8, serde_bytes::ByteBuf));
test_round(ExtStruct((2, serde_bytes::ByteBuf::from(vec![5]))),
Value::Ext(2, vec![5]));