[−][src]Function msgpack_simple::parser::parse
pub fn parse(raw: &[u8]) -> Result<(MsgPack, usize), ParseError>
Parses binary data as MsgPack, returning both the result and the length of the data. Useful when you have other data directly following in the slice.
use msgpack_simple::parser; let data = vec![0xaa, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x52, 0x75, 0x73, 0x74, 0x00]; let (decoded, length) = parser::parse(&data).unwrap(); assert!(decoded.is_string()); assert_eq!(decoded.as_string().unwrap(), "Hello Rust".to_string()); assert_eq!(length, 11);