msgpackin 0.0.4

Msgpackin pure Rust MessagePack encoding / decoding library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::*;

#[test]
fn std_encode_decode_demo() {
    let expect = Value::Map(vec![("foo".into(), "bar".into())]);
    let mut buf = Vec::new();

    {
        let writer: Box<dyn std::io::Write> = Box::new(&mut buf);
        expect.to_sync(writer).unwrap();
    }

    let reader: Box<dyn std::io::Read> = Box::new(buf.as_slice());
    let decoded = Value::from_sync(reader).unwrap();
    assert_eq!(expect, decoded);
}