Function transit_model::netex_utils::get_value_in_keylist
source · pub fn get_value_in_keylist<F>(element: &Element, key: &str) -> Result<F>where
F: FromStr,
Expand description
Returns the value from its key in a <KeyList>
XML element (standard
element of NeTEx format). You can convert the result into the type you want.
let xml = r#"<root>
<KeyList>
<KeyValue>
<Key>key</Key>
<Value>42</Value>
</KeyValue>
</KeyList>
</root>"#;
let root: Element = xml.parse().unwrap();
let value: u32 = get_value_in_keylist(&root, "key").unwrap();
assert_eq!(42, value);