XmlWriter

Struct XmlWriter 

Source
pub struct XmlWriter<W: Write> { /* private fields */ }
Expand description

An XML writer that produces well-formed XML output.

Implementations§

Source§

impl<W: Write> XmlWriter<W>

Source

pub fn new(writer: W) -> Self

Creates a new XML writer.

Source

pub fn with_indent(writer: W, indent: IndentConfig) -> Self

Creates a new XML writer with indentation.

Source

pub fn into_inner(self) -> W

Returns the inner writer.

Source

pub fn depth(&self) -> usize

Returns the current nesting depth.

Source

pub fn write_declaration( &mut self, version: &str, encoding: Option<&str>, ) -> Result<()>

Writes the XML declaration.

Source

pub fn start_element(&mut self, name: &str) -> Result<()>

Starts an element.

Source

pub fn write_attribute(&mut self, name: &str, value: &str) -> Result<()>

Writes an attribute for the current element.

Source

pub fn end_element(&mut self) -> Result<()>

Ends the current element.

Source

pub fn write_text(&mut self, text: &str) -> Result<()>

Writes text content.

Source

pub fn write_cdata(&mut self, data: &str) -> Result<()>

Writes a CDATA section.

Source

pub fn write_comment(&mut self, comment: &str) -> Result<()>

Writes a comment.

Source

pub fn write_pi(&mut self, target: &str, data: Option<&str>) -> Result<()>

Writes a processing instruction.

Source

pub fn write_element(&mut self, name: &str, content: &str) -> Result<()>

Writes a complete element with text content.

Source

pub fn write_empty_element(&mut self, name: &str) -> Result<()>

Writes an empty element.

Source

pub fn flush(&mut self) -> Result<()>

Flushes the writer.

Auto Trait Implementations§

§

impl<W> Freeze for XmlWriter<W>
where W: Freeze,

§

impl<W> RefUnwindSafe for XmlWriter<W>
where W: RefUnwindSafe,

§

impl<W> Send for XmlWriter<W>
where W: Send,

§

impl<W> Sync for XmlWriter<W>
where W: Sync,

§

impl<W> Unpin for XmlWriter<W>
where W: Unpin,

§

impl<W> UnwindSafe for XmlWriter<W>
where W: UnwindSafe,

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.