pub struct XmlWriter { /* private fields */ }Expand description
Writes an XML document into a string, which take
hands out as it grows (matplotlib’s backend_svg.XMLWriter).
use pltrs_render::XmlWriter;
let mut xml = XmlWriter::new("");
let svg = xml.start("svg", &[("width", "10pt".into())]);
xml.element("title", "a < b", &[]);
xml.close(svg);
assert_eq!(xml.take(), "<svg width=\"10pt\">\n <title>a < b</title>\n</svg>\n");
assert_eq!(xml.take(), "");Implementations§
Source§impl XmlWriter
impl XmlWriter
Sourcepub fn start(&mut self, tag: &str, attributes: &[Attribute<'_>]) -> usize
pub fn start(&mut self, tag: &str, attributes: &[Attribute<'_>]) -> usize
Opens an element; returns its depth for close.
Sourcepub fn element(&mut self, tag: &str, text: &str, attributes: &[Attribute<'_>])
pub fn element(&mut self, tag: &str, text: &str, attributes: &[Attribute<'_>])
Writes a whole element with optional character data.
The open elements, outermost first, as their tags were escaped.
Trait Implementations§
Auto Trait Implementations§
impl Forget for XmlWriter
impl Freeze for XmlWriter
impl Move for XmlWriter
impl RefUnwindSafe for XmlWriter
impl Send for XmlWriter
impl Sync for XmlWriter
impl Unpin for XmlWriter
impl UnsafeUnpin for XmlWriter
impl UnwindSafe for XmlWriter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more