Struct xml5ever::serialize::XmlSerializer

source ·
pub struct XmlSerializer<Wr> {
    writer: Wr,
    namespace_stack: NamespaceMapStack,
}
Expand description

Struct used for serializing nodes into a text that other XML parses can read.

Serializer contains a set of functions (start_elem, end_elem…) that make parsing nodes easier.

Fields§

§writer: Wr§namespace_stack: NamespaceMapStack

Implementations§

source§

impl<Wr: Write> XmlSerializer<Wr>

source

pub fn new(writer: Wr) -> Self

Creates a new Serializier from a writer and given serialization options.

source

fn qual_name(&mut self, name: &QualName) -> Result<()>

source

fn qual_attr_name(&mut self, name: &QualName) -> Result<()>

source

fn find_uri(&self, name: &QualName) -> bool

source

fn find_or_insert_ns(&mut self, name: &QualName)

Trait Implementations§

source§

impl<Wr: Write> Serializer for XmlSerializer<Wr>

source§

fn start_elem<'a, AttrIter>( &mut self, name: QualName, attrs: AttrIter, ) -> Result<()>
where AttrIter: Iterator<Item = AttrRef<'a>>,

Serializes given start element into text. Start element contains qualified name and an attributes iterator.

source§

fn end_elem(&mut self, name: QualName) -> Result<()>

Serializes given end element into text.

source§

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

Serializes comment into text.

source§

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

Serializes given doctype

source§

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

Serializes text for a node or an attributes.

source§

fn write_processing_instruction( &mut self, target: &str, data: &str, ) -> Result<()>

Serializes given processing instruction.

Auto Trait Implementations§

§

impl<Wr> Freeze for XmlSerializer<Wr>
where Wr: Freeze,

§

impl<Wr> RefUnwindSafe for XmlSerializer<Wr>
where Wr: RefUnwindSafe,

§

impl<Wr> Send for XmlSerializer<Wr>
where Wr: Send,

§

impl<Wr> Sync for XmlSerializer<Wr>
where Wr: Sync,

§

impl<Wr> Unpin for XmlSerializer<Wr>
where Wr: Unpin,

§

impl<Wr> UnwindSafe for XmlSerializer<Wr>
where Wr: 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>,

§

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>,

§

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.