pub fn from_slice_with_options<'input, 'facet, T>(
xml: &'input [u8],
options: &DeserializeOptions,
) -> Result<T, XmlError>where
T: Facet<'facet>,
'input: 'facet,Expand description
Deserialize an XML byte slice into a value of type T with custom options.
This is a convenience wrapper around from_str_with_options that first validates
that the input is valid UTF-8.
ยงExample
use facet::Facet;
use facet_xml::{self as xml, DeserializeOptions};
#[derive(Facet, Debug, PartialEq)]
struct Person {
#[facet(xml::attribute)]
name: String,
}
let options = DeserializeOptions::default().deny_unknown_fields(true);
let xml_bytes = b"<Person name=\"Alice\"/>";
let person: Person = xml::from_slice_with_options(xml_bytes, &options).unwrap();
assert_eq!(person.name, "Alice");