Substitute for optional doesn't work right
AldaronLau opened this issue · 1 comments
AldaronLau commented
With this MuON file:
sig:
sig: Allegro
time_symbol: true
swing_text: Swing = 60%
And this Rust code:
#[derive(PartialEq, Debug, Serialize, Deserialize)]
pub struct SigStyle {
pub tempo: Option<String>,
pub time_symbol: bool,
pub swing_text: Option<String>,
}
#[derive(PartialEq, Debug, Default, Serialize, Deserialize)]
pub struct Style {
pub sig: Vec<SigStyle>,
}
fn main() {
let input = include_str!("../scof/Style.muon");
let style: Style = muon::from_str(input).unwrap();
println!("{:?}", style);
let output = muon::to_string(&style).unwrap();
println!("{}", output);
let style_clone: Style = muon::from_str(&output).unwrap();
assert_eq!(style, style_clone);
assert_eq!(input, output);
}
This panics with a FailedParse("bool: Allegro")
DougLau commented
Substitution not supported with optional types, but the error should make sense with the latest commits.