pub trait MsgUnpack<'buf> {
// Required method
fn unpack(bytes: &mut &'buf [u8]) -> Result<Self, UnpackErr>
where Self: Sized;
}
Expand description
Trait for deserializing a type using msgpack.
Required Methods§
Sourcefn unpack(bytes: &mut &'buf [u8]) -> Result<Self, UnpackErr>where
Self: Sized,
fn unpack(bytes: &mut &'buf [u8]) -> Result<Self, UnpackErr>where
Self: Sized,
Unpack a value from a msgpack bytes slice
use msgpck::MsgUnpack;
let encoded = [0x93, 0xCC, 0xDD, 0xCC, 0xEE, 3];
let decoded: Vec<u8> = Vec::unpack(&mut &encoded[..]).unwrap();
assert_eq!(decoded, &[0xDDu8, 0xEE, 3]);