Macro msgpack_schema::msgpack [−][src]
macro_rules! msgpack { ( $( $tt: tt )+ ) => { ... }; }
Expand description
Constructs a MessagePack object.
Return type is an opaque type implementing Serialize.
Example
msgpack!( // array literal [ // numeric literals 0, -42, 3.14, 2.71f32, // actually any expression is allowed (as long as it's a supported type) 1 + 2 + 3, // boolean true, false, // nil is a keyword denoting the nil object nil, // map object { "any value in key": nil }, { 0: 1, "trailing comma is ok": nil, }, // string literal to make a string object "hello", // Use an expression of [Bin] type to create a binary object Bin(vec![0xDE, 0xAD, 0xBE, 0xEF]) ] )