-
Notifications
You must be signed in to change notification settings - Fork 260
Open
Labels
arraysIssues related to mapping XML content onto arrays using serdeIssues related to mapping XML content onto arrays using serdebughelp wantedserdeIssues related to mapping from Rust types to XMLIssues related to mapping from Rust types to XML
Description
Deserialization of a list in an attribute value does not treat the tab character as a separator, despite the documentation stating that it should.
use quick_xml::de::Deserializer;
use serde::Deserialize;
#[derive(Debug, Deserialize)]
struct Any {
#[serde(rename = "@list")]
list: Vec<Item>,
}
#[derive(Debug, PartialEq, Deserialize)]
#[serde(rename_all = "lowercase")]
enum Item {
Foo,
Bar,
}
#[test]
fn main() {
// The separator between the two characters is a tab.
let str = r#"<any list="foo bar" />"#;
let mut deser = Deserializer::from_str(str);
let any = Any::deserialize(&mut deser).unwrap();
assert_eq!(any.list, vec![Item::Foo, Item::Bar]);
}
Expected behavior: The assertion passes.
Actual behavior: thread 'main' panicked at 'called Result::unwrap()
on an Err
value: Custom("unknown variant foo\tbar
, expected foo
or bar
")'
Metadata
Metadata
Assignees
Labels
arraysIssues related to mapping XML content onto arrays using serdeIssues related to mapping XML content onto arrays using serdebughelp wantedserdeIssues related to mapping from Rust types to XMLIssues related to mapping from Rust types to XML