msgpacker 0.7.0

MessagePack protocol implementation for Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use msgpacker::{Packable, Unpackable};

#[allow(unused)]
pub fn case<T>(x: T)
where
    T: Packable + Unpackable + PartialEq + core::fmt::Debug,
    <T as Unpackable>::Error: core::fmt::Debug,
{
    let mut bytes = vec![];
    let n = x.pack(&mut bytes);
    assert_eq!(n, bytes.len());
    let (o, y) = T::unpack_with_ofs(&bytes).unwrap();
    let (p, z) = T::unpack_iter(bytes).unwrap();
    assert_eq!(n, o);
    assert_eq!(n, p);
    assert_eq!(x, y);
    assert_eq!(x, z);
}