From e351a7313c4ffd769baf5b7fba13d67632d0b033 Mon Sep 17 00:00:00 2001 From: Colin Rofls Date: Fri, 17 Mar 2023 15:21:35 -0400 Subject: [PATCH] Revert API change in 53c603c In the previous version of quick-xml there was an issue that prevented deserialization of Option>. We worked around this by changing our API, but that change was not an improvement, and the issue is fixed in quick-xml 0.28. Since I intend to yank norad 0.9, we can revert that change, providing a better upgrade path for our users. --- src/designspace.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/designspace.rs b/src/designspace.rs index dae4c80a..6a568d28 100644 --- a/src/designspace.rs +++ b/src/designspace.rs @@ -55,8 +55,7 @@ pub struct Axis { #[serde(rename = "@values")] pub values: Option>, /// Mapping between user space coordinates and design space coordinates. - #[serde(default)] - pub map: Vec, + pub map: Option>, } /// Maps one input value (user space coord) to one output value (design space coord). @@ -233,7 +232,10 @@ mod tests { assert_eq!(axis.minimum, Some(400.)); assert_eq!(axis.maximum, Some(600.)); assert_eq!(axis.default, 500.); - assert_eq!(&vec![AxisMapping { input: 400., output: 100. }], &ds.axes[0].map); + assert_eq!( + &vec![AxisMapping { input: 400., output: 100. }], + ds.axes[0].map.as_ref().unwrap() + ); assert_eq!(1, ds.sources.len()); let weight_100 = dim_name_xvalue("Weight", 100.); assert_eq!(vec![weight_100.clone()], ds.sources[0].location); @@ -245,7 +247,7 @@ mod tests { fn read_wght_variable() { let ds = DesignSpaceDocument::load("testdata/wght.designspace").unwrap(); assert_eq!(1, ds.axes.len()); - assert!(ds.axes[0].map.is_empty()); + assert!(ds.axes[0].map.is_none()); assert_eq!( vec![ ("TestFamily-Regular.ufo".to_string(), vec![dim_name_xvalue("Weight", 400.)]),