std::encoding::msgpackMessagePack serialization.
Encode and decode values using the MessagePack binary format. Supports conversion between JSON strings and MessagePack bytes, as well as encoding individual typed values.
import std::encoding::msgpack;
import std::encoding::hex;
fn main() {
let packed = msgpack.from_json("{\"x\": 1}");
println(packed.len());
let json = msgpack.to_json(packed);
println(json);
}
from_jsonEncode a JSON string to MessagePack binary.
Returns an empty bytes buffer on invalid JSON.
to_jsonDecode a MessagePack bytes buffer to a JSON string.
Returns an empty string on error.
encode_intEncode an integer as a MessagePack varint.
encode_stringEncode a string as MessagePack str.
encode_bytesEncode binary data as a MessagePack bin.