Simplified, easy to use, pure Rust MessagePack implementation focused on handling dynamic data structures.
Example usage:
```rust use msgpack_simple::{MsgPack, MapElement, Extension};
let message = MsgPack::Map(vec![ MapElement { key: MsgPack::String(String::from("hello")), value: MsgPack::Int(42) }, MapElement { key: MsgPack::String(String::from("world")), value: MsgPack::Array(vec![ MsgPack::Boolean(true), MsgPack::Nil, MsgPack::Binary(vec![0x42, 0xff]), MsgPack::Extension(Extension { type_id: 2, value: vec![0x32, 0x4a, 0x67, 0x11] }) ]) } ]);
let encoded = message.encode(); // encoded is a Vec
println!("{}", decoded); asserteq!(message, decoded); assert!(message.ismap());
let mut map = message.asmap().unwrap(); // map is a Vec
assert!(secondelement.key.isstring()); asserteq!(secondelement.key.asstring().unwrap(), "world".tostring());
assert!(secondelement.value.isarray());
let mut array = secondelement.value.asarray().unwrap(); // array is a Vec
assert!(nil.is_nil()); ```
This library abstracts MessagePack data into a single MsgPack enum which can correspond to any encodable data type and handle nested data structures dynamically. It's not as performant as static solutions, for that, mneumann's rust-msgpack and 3Hren's RMP crates are recommended, but it is able to parse messages without full prior knowledge of their structure.
For more details, check out the documentation.
As always, pull requests, bug reports, suggestions, and other kinds of improvements are welcome. Just be respectful towards each other, and maybe run or create tests as appropriate.
msgpack_simple is available under the MIT license.