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>

source

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

Adds an attribute to this element.

source

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.

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>(self, closure: F) -> Result<&'a mut Writer<W>>where F: FnOnce(&mut Writer<W>) -> Result<()>,

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

Auto Trait Implementations§

§

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.