Struct quick_xml::writer::ElementWriter
source · pub struct ElementWriter<'a, W: Write> { /* private fields */ }
Expand description
A struct to write an element. Contains methods to add attributes and inner elements to the element
Implementations§
source§impl<'a, W: Write> ElementWriter<'a, W>
impl<'a, W: Write> ElementWriter<'a, W>
sourcepub fn with_attribute<'b, I>(self, attr: I) -> Selfwhere
I: Into<Attribute<'b>>,
pub fn with_attribute<'b, I>(self, attr: I) -> Selfwhere
I: Into<Attribute<'b>>,
Adds an attribute to this element.
sourcepub fn with_attributes<'b, I>(self, attributes: I) -> Selfwhere
I: IntoIterator,
I::Item: Into<Attribute<'b>>,
pub fn with_attributes<'b, I>(self, attributes: I) -> Selfwhere
I: IntoIterator,
I::Item: Into<Attribute<'b>>,
Add additional attributes to this element using an iterator.
The yielded items must be convertible to Attribute
using Into
.
sourcepub fn write_text_content(self, text: BytesText<'_>) -> Result<&'a mut Writer<W>>
pub fn write_text_content(self, text: BytesText<'_>) -> Result<&'a mut Writer<W>>
Write some text inside the current element.
sourcepub fn write_cdata_content(
self,
text: BytesCData<'_>
) -> Result<&'a mut Writer<W>>
pub fn write_cdata_content(
self,
text: BytesCData<'_>
) -> Result<&'a mut Writer<W>>
Write a CData event <![CDATA[...]]>
inside the current element.
sourcepub fn write_pi_content(self, text: BytesText<'_>) -> Result<&'a mut Writer<W>>
pub fn write_pi_content(self, text: BytesText<'_>) -> Result<&'a mut Writer<W>>
Write a processing instruction <?...?>
inside the current element.
sourcepub fn write_empty(self) -> Result<&'a mut Writer<W>>
pub fn write_empty(self) -> Result<&'a mut Writer<W>>
Write an empty (self-closing) tag.