This example program probably ought to exit successfully
fn main() {
let input = "1.0";
let v: ron::Value = ron::from_str(input).unwrap();
println!("{:?}", v);
let ser = ron::to_string(&v).unwrap();
println!("{:?}", ser);
let roundtrip = ron::from_str(&ser).unwrap();
println!("{:?}", roundtrip);
assert_eq!(v, roundtrip);
}
But it doesn't:
Number(Float(Float(1.0)))
"1"
Number(Integer(1))
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `Number(Float(Float(1.0)))`,
right: `Number(Integer(1))`', src/main.rs:9:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
This seems plausible as a ser/de behavior if RON only has a number type, but if that's the case ron::Value::Number should depend only on the numeric value not the discriminant.
This example program probably ought to exit successfully
But it doesn't:
This seems plausible as a ser/de behavior if RON only has a number type, but if that's the case
ron::Value::Numbershould depend only on the numeric value not the discriminant.