Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

14
Task/JSON/Rust/json.rust Normal file
View file

@ -0,0 +1,14 @@
extern crate serialize;
use serialize::json;
#[deriving(Decodable, Encodable)]
struct Penguin {
name : String,
born : i16
}
fn main() {
let pengu = Penguin { name : "pengu".to_string(), born : 1999 };
println!("{}", json::encode(&pengu));
let pingu : Penguin = json::decode(r##"{"name":"pingu","born":2001}"##).unwrap();
assert_eq!(pingu.name.as_slice(), "pingu");
assert_eq!(pingu.born, 2001);
}