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