Skip to main content

CollectXml

Trait CollectXml 

Source
pub trait CollectXml
where Self: Sized,
{ // Required method fn collect_xml(self) -> Xml; }
Expand description

Collect XML from an iterator.

§Example

use inline_xml::*;

let v = [1, 2, 3];
let xml = xml! {
    <root>
    {v.into_iter().map(|x| xml! { <p>{x}</p> }).collect_xml()}
    </root>
};
println!("{xml}");

§Output

<root>
    <p>1</p>
    <p>2</p>
    <p>3</p>
</root>

Required Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T, I> CollectXml for I
where T: ToXml, I: Iterator<Item = T>,