#[non_exhaustive]pub struct Config {
pub add_space_before_slash_in_empty_elements: bool,
}Expand description
A struct that holds a writer configuration.
The current writer configuration can be retrieved by calling
Writer::config() and changed through Writer::config_mut().
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.add_space_before_slash_in_empty_elements: boolWhether to add a space before the closing slash in empty elements. According to the W3C guidelines, this is recommended for maximum compatibility.
When set to true, empty elements are terminated with “ />”. When set to
false, empty elements are terminated with “/>”.
Default: false.
§Example
use oxixml_xml::writer::Writer;
let mut writer = Writer::new(Vec::new());
writer.config_mut().add_space_before_slash_in_empty_elements = true;
writer.create_element("tag")
.with_attribute(("attr1", "value1"))
.write_empty()
.expect("write");
assert_eq!(writer.into_inner(), br#"<tag attr1="value1" />"#);Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
Available on crate feature serde-types only.
impl<'de> Deserialize<'de> for Config
Available on crate feature
serde-types only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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