Struct xml2json_rs::XmlConfig
source · [−]pub struct XmlConfig { /* private fields */ }
Expand description
XmlBuilder configuration options
Implementations
sourceimpl XmlConfig
impl XmlConfig
sourcepub fn new() -> XmlConfig
pub fn new() -> XmlConfig
Initialze a new XmlConfig instance.
This uses the builder pattern. All options are initialized to None
and can be set using
self
s methods. Any options not set will use their defaults upon call to finalize
.
sourcepub fn root_name<T: Into<String>>(&mut self, key: T) -> &mut XmlConfig
pub fn root_name<T: Into<String>>(&mut self, key: T) -> &mut XmlConfig
Root key name to contain produced JSON object.
When this is set to its default value “root”, the output will not be wrapped in root_name
’s
value. This is to conform to match the behavior of node-xml2js.
("root"
by default)
sourcepub fn attrkey<T: Into<String>>(&mut self, key: T) -> &mut XmlConfig
pub fn attrkey<T: Into<String>>(&mut self, key: T) -> &mut XmlConfig
Attribute key
The value of the JSON key used to store XML attributes under.
("$"
by default)
sourcepub fn charkey<T: Into<String>>(&mut self, key: T) -> &mut XmlConfig
pub fn charkey<T: Into<String>>(&mut self, key: T) -> &mut XmlConfig
Char data key
The value of the JSON key used to store XML character data under.
("_"
by default)
sourcepub fn decl(&mut self, decl: Declaration) -> &mut XmlConfig
pub fn decl(&mut self, decl: Declaration) -> &mut XmlConfig
XML Declaration
(Declaration::default() by default) Declaration::default(): Declaration::default
sourcepub fn rendering(&mut self, indentation: Indentation) -> &mut XmlConfig
pub fn rendering(&mut self, indentation: Indentation) -> &mut XmlConfig
Rendering indentation options
(None
by default)
sourcepub fn finalize(&self) -> XmlBuilder
pub fn finalize(&self) -> XmlBuilder
Finalize configuration options and build an XmlBuilder instance
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for XmlConfig
impl Send for XmlConfig
impl Sync for XmlConfig
impl Unpin for XmlConfig
impl UnwindSafe for XmlConfig
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more