fn next(&mut self) -> Result<XmlEvent> {
        loop {
            match self.buffer.get_mut(self.cursor) {
                Some(entry @ CachedXmlEvent::Unused(_)) => {
                    let taken = if self.cursor == 0 {
                        self.buffer.pop_front().unwrap()
                    } else {
                        std::mem::replace(entry, CachedXmlEvent::Used)
                    };

                    return debug_expect!(taken, CachedXmlEvent::Unused(ev) => Ok(ev));
                }
                Some(CachedXmlEvent::Used) => {
                    debug_assert!(
                        self.cursor != 0,
                        "Event buffer should not start with 'used' slot (should have been popped)"
                    );
                    self.cursor += 1;
                    continue;
                }
                None => {
                    debug_assert_eq!(self.buffer.len(), self.cursor);

                    // Skip creation of buffer entry when consuming event straight away
                    return next_significant_event(&mut self.reader);
                }
            }
        }
    }
/// Consumed XML events in a child buffer are marked as "used"
Consumed XML events in a child buffer are marked as "used"
Consumed XML events in a child buffer are marked as " used "
fn next(&mut self) -> Result<XmlEvent> {
        loop {
            match self.buffer.get_mut(self.cursor) {
                Some(entry @ CachedXmlEvent::Unused(_)) => {
                    let taken = if self.cursor == 0 {
                        self.buffer.pop_front().unwrap()
                    } else {
                        std::mem::replace(entry, CachedXmlEvent::Used)
                    };
                    return debug_expect!(taken, CachedXmlEvent::Unused(ev) => Ok(ev));
                }
                Some(CachedXmlEvent::Used) => {
                    debug_assert!(
                        self.cursor != 0,
                        "Event buffer should not start with 'used' slot (should have been popped)"
                    );
                    self.cursor += 1;
                    continue;
                }
                None => {
                    debug_assert_eq!(self.buffer.len(), self.cursor);
                    // Skip creation of buffer entry when consuming event straight away
                    return next_significant_event(&mut self.reader);
                }
            }
        }
    }
fn next ( & mut self ) -> Result < XmlEvent > { loop { match self . buffer . get_mut ( self . cursor ) { Some ( entry @ CachedXmlEvent :: Unused ( _ ) ) => { let taken = if self . cursor == 0 { self . buffer . pop_front ( ) . unwrap ( ) } else { std :: mem :: replace ( entry , CachedXmlEvent :: Used ) } ; return debug_expect ! ( taken CachedXmlEvent Unused ( ev ) Ok ( ev ) ) ; } Some ( CachedXmlEvent :: Used ) => { debug_assert ! ( self cursor 0 " " ) ; self . cursor += 1 ; continue ; } None => { debug_assert_eq ! ( self buffer len ( ) self cursor ) ; // Skip creation of buffer entry when consuming event straight away return next_significant_event ( & mut self . reader ) ; } } } }
Consumed XML events in a child buffer are marked as "used"
Consumed XML events in a child buffer are marked as " used "
&mut self