Msgpack implementation for Rust language.
extern mod msgpack = "msgpack#0.1";
fn main() {
let arr = ~[~"str1", ~"str2"];
let str = msgpack::to_msgpack(&arr);
println!("Encoded: {:?}", str);
let dec: ~[~str] = msgpack::from_msgpack(str);
println!("Decoded: {:?}", dec);
}
To enable your own data structures to be automatically serialized from and to
msgpack, derive from Encodable
and Decodable
as shown
in the following example:
extern mod serialize;
#[deriving(Encodable,Decodable)]
struct MyStruct {
a: ~[u32],
s: ~str
}
This code licensed under the same terms as Rust itself: dual MIT/Apache2 license options.