pub struct SerdeXml { /* private fields */ }
Implementations§
Source§impl SerdeXml
impl SerdeXml
pub fn new() -> Self
pub fn emitter(self, emitter: EmitterConfig) -> Self
pub fn parser(self, parser: ParserConfig) -> Self
pub fn default_namespace<S: ToString>(self, name: S) -> Self
pub fn namespace<S: ToString>(self, prefix: S, name: S) -> Self
Sourcepub fn overlapping_sequences(self, b: bool) -> Self
pub fn overlapping_sequences(self, b: bool) -> Self
Configures whether the deserializer should search all sibling elements when building a sequence. Not required if all XML elements for sequences are adjacent. Disabled by default. Enabling this option may incur additional memory usage.
#[derive(Debug, Deserialize, PartialEq)]
struct Foo {
bar: Vec<usize>,
baz: String,
}
let s = r##"
<foo>
<bar>1</bar>
<bar>2</bar>
<baz>Hello, world</baz>
<bar>3</bar>
<bar>4</bar>
</foo>
"##;
let foo: Foo = serde_xml_rs::SerdeXml::new().overlapping_sequences(true).from_str(s).unwrap();
assert_eq!(foo, Foo { bar: vec![1, 2, 3, 4], baz: "Hello, world".to_string()});
pub fn from_str<'de, T: Deserialize<'de>>(self, s: &str) -> Result<T, Error>
pub fn from_reader<'de, T: Deserialize<'de>, R: Read>( self, reader: R, ) -> Result<T, Error>
pub fn to_string<S: Serialize>(self, value: &S) -> Result<String, Error>
pub fn to_writer<W, S>(self, writer: W, value: &S) -> Result<(), Error>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SerdeXml
impl RefUnwindSafe for SerdeXml
impl Send for SerdeXml
impl Sync for SerdeXml
impl Unpin for SerdeXml
impl UnwindSafe for SerdeXml
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more