quick_xml::writer

Struct ElementWriter

Source
pub struct ElementWriter<'a, W> { /* 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> ElementWriter<'a, W>

Source

pub fn with_attribute<'b, I>(self, attr: I) -> Self
where I: Into<Attribute<'b>>,

Adds an attribute to this element.

Source

pub fn with_attributes<'b, I>(self, attributes: I) -> Self
where 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.

Source§

impl<'a, W: Write> ElementWriter<'a, W>

Source

pub fn write_text_content( self, text: BytesText<'_>, ) -> Result<&'a mut Writer<W>>

Write some text inside the current element.

Source

pub fn write_cdata_content( self, text: BytesCData<'_>, ) -> Result<&'a mut Writer<W>>

Write a CData event <![CDATA[...]]> inside the current element.

Source

pub fn write_pi_content(self, text: BytesText<'_>) -> Result<&'a mut Writer<W>>

Write a processing instruction <?...?> inside the current element.

Source

pub fn write_empty(self) -> Result<&'a mut Writer<W>>

Write an empty (self-closing) tag.

Source

pub fn write_inner_content<F, E>( self, closure: F, ) -> StdResult<&'a mut Writer<W>, E>
where F: FnOnce(&mut Writer<W>) -> StdResult<(), E>, E: From<Error>,

Create a new scope for writing XML inside the current element.

Auto Trait Implementations§

§

impl<'a, W> Freeze for ElementWriter<'a, W>

§

impl<'a, W> RefUnwindSafe for ElementWriter<'a, W>
where W: RefUnwindSafe,

§

impl<'a, W> Send for ElementWriter<'a, W>
where W: Send,

§

impl<'a, W> Sync for ElementWriter<'a, W>
where W: Sync,

§

impl<'a, W> Unpin for ElementWriter<'a, W>

§

impl<'a, W> !UnwindSafe for ElementWriter<'a, W>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.