Struct quick_xml::Element [] [src]

pub struct Element {
    // some fields omitted
}

Wrapper around Vec representing the content of an event (aka node)

The purpose of not returning a String directly is to postpone calculations (utf8 conversion) to the last moment: byte checks are enough in most cases

Methods

impl Element
[src]

fn new<A>(name: A) -> Element where A: AsRef<[u8]>

Creates a new Element from the given name. name is a reference that can be converted to a byte slice, such as &[u8] or &str

fn with_attributes<K, V, I>(self, attributes: I) -> Self where K: AsRef<[u8]>, V: AsRef<[u8]>, I: IntoIterator<Item=(K, V)>

Consumes self and adds attributes to this element from an iterator over (key, value) tuples. Key and value can be anything that implements the AsRef<[u8]> trait, like byte slices and strings.

fn name(&self) -> &[u8]

name as &u8

fn content(&self) -> &[u8]

whole content as &u8

fn attributes(&self) -> Attributes

get attributes iterator

fn extend_attributes<K, V, I>(&mut self, attributes: I) -> &mut Element where K: AsRef<[u8]>, V: AsRef<[u8]>, I: IntoIterator<Item=(K, V)>

extend the attributes of this element from an iterator over (key, value) tuples. Key and value can be anything that implements the AsRef<[u8]> trait, like byte slices and strings.

fn into_string(self) -> Result<String>

consumes entire self (including eventual attributes!) and returns String

useful when we need to get Text event value (which don't have attributes)

fn push_attribute<K, V>(&mut self, key: K, value: V) where K: AsRef<[u8]>, V: AsRef<[u8]>

Adds an attribute to this element from the given key and value. Key and value can be anything that implements the AsRef<[u8]> trait, like byte slices and strings.

Trait Implementations

impl Clone for Element
[src]

fn clone(&self) -> Element

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl Debug for Element
[src]

fn fmt(&self, f: &mut Formatter) -> Result<()Error>

Formats the value using the given formatter.