pub struct Element { /* private fields */ }Available on crate feature
container only.Expand description
An XML element with ordered attributes and children.
Implementations§
Source§impl Element
impl Element
Sourcepub fn attr(self, name: &str, value: &str) -> Self
pub fn attr(self, name: &str, value: &str) -> Self
Adds an attribute (escaped on render). Repeats are kept in order.
Sourcepub fn render(&self) -> String
pub fn render(&self) -> String
Serializes this element and its descendants. No XML declaration is prepended; a caller that
wants one writes DECLARATION first.
Sourcepub fn render_document(&self) -> String
pub fn render_document(&self) -> String
Serializes a complete document part: the XML DECLARATION, then this element.
Sourcepub fn render_document_pretty(&self) -> String
pub fn render_document_pretty(&self) -> String
Serializes a complete document part with two-space indentation: the XML DECLARATION, this
element laid out over multiple lines, and a trailing newline. An element holding only text
stays on one line; an element with child elements puts each child on its own indented line.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Element
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnsafeUnpin for Element
impl UnwindSafe for Element
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