1use std::io::BufRead;
2
3use quick_xml::events::BytesStart;
4
5use crate::{XmlDeserialize, XmlError};
6
7#[derive(Debug, Clone, PartialEq)]
9pub struct Unparsed(BytesStart<'static>);
10
11impl Unparsed {
12 pub fn tag_name(&self) -> String {
13 String::from_utf8_lossy(self.0.local_name().as_ref()).to_string()
15 }
16}
17
18impl XmlDeserialize for Unparsed {
19 fn deserialize<R: BufRead>(
20 reader: &mut quick_xml::NsReader<R>,
21 start: &BytesStart,
22 empty: bool,
23 ) -> Result<Self, XmlError> {
24 if !empty {
26 let mut buf = vec![];
27 reader.read_to_end_into(start.name(), &mut buf)?;
28 }
29 Ok(Self(start.to_owned()))
30 }
31}