-
Notifications
You must be signed in to change notification settings - Fork 137
Closed
Labels
Description
#[macro_use]
extern crate serde;
extern crate ron;
use ron::de::*;
use ron::ser;
use ron::value::Value;
#[derive(Serialize)]
struct Scene(Option<(u32, u32)>);
#[derive(Serialize)]
struct Scene2 {
foo: Option<(u32, u32)>,
}
fn main() {
{
let s = ser::to_string(&Scene2 { foo: Some((1, 1)) }).unwrap();
println!("{}", s);
let scene: Value = from_str(&s).unwrap();
println!("{:?}", scene);
}
{
let s = ser::to_string(&Scene( Some((1, 1)) )).unwrap();
println!("{}", s);
let scene: Value = from_str(&s).unwrap();
println!("{:?}", scene);
}
}
The first example gives:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Parser(ExpectedIdentifier, Position { col: 12, line: 1 })', libcore/result.rs:945:5
The second gives:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Parser(ExpectedMapColon, Position { col: 6, line: 1 })', libcore/result.rs:945:5
schneiderfelipe