use super::*; #[derive(Default, Debug, PartialEq, Eq)] pub struct Ignore; impl FromXml for Ignore { type P = impl Parser>; fn parse() -> Self::P { |(mut namespace, mut event): (ResolveResult<'static>, &'static Event<'static>)| -> Result { let mut depth = match event { Event::Start(bytes) => 0, Event::Empty(_) => return Ok(Ignore), _ => return Ok(Ignore), }; loop { (namespace, event) = yield; match event { Event::End(_) => { if depth == 0 { return Ok(Ignore); } else { depth -= 1; } } Event::Start(_) => { depth += 1; } _ => (), } } } } } impl ToXml for () { fn serialize(&self, _: &mut Vec>) {} }