hard_xml/
xml_write.rs

1use std::io::Write;
2
3use crate::{XmlResult, XmlWriter};
4
5pub trait XmlWrite {
6    fn to_writer<W: Write>(&self, writer: &mut XmlWriter<W>) -> XmlResult<()>;
7
8    fn to_string(&self) -> XmlResult<String> {
9        let mut writer = XmlWriter::new(Vec::new());
10
11        self.to_writer(&mut writer)?;
12
13        Ok(String::from_utf8(writer.inner)?)
14    }
15}