pub fn pop(&mut self) -> Option<(Key, Cow<'event, [u8]>)> {
        let mut values = vec![];
        // events are popped in reverse order
        while let Some(e) = self.section.0.pop() {
            match e {
                Event::Key(k) => {
                    // pop leading whitespace
                    if let Some(Event::Whitespace(_)) = self.section.0.last() {
                        self.section.0.pop();
                    }

                    if values.len() == 1 {
                        let value = values.pop().expect("vec is non-empty but popped to empty value");
                        return Some((k, normalize_cow(value)));
                    }

                    return Some((
                        k,
                        normalize_vec(values.into_iter().rev().flat_map(|v: Cow<[u8]>| v.to_vec()).collect()),
                    ));
                }
                Event::Value(v) | Event::ValueNotDone(v) | Event::ValueDone(v) => values.push(v),
                _ => (),
            }
        }
        None
    }
/// Removes all events until a key value pair is removed. This will also
/// remove the whitespace preceding the key value pair, if any is found.
Removes all events until a key value pair is removed. This will also
remove the whitespace preceding the key value pair, if any is found.
Removes all events until a key value pair is removed . This will also remove the whitespace preceding the key value pair if any is found .
pub fn pop(&mut self) -> Option<(Key, Cow<'event, [u8]>)> {
        let mut values = vec![];
        // events are popped in reverse order
        while let Some(e) = self.section.0.pop() {
            match e {
                Event::Key(k) => {
                    // pop leading whitespace
                    if let Some(Event::Whitespace(_)) = self.section.0.last() {
                        self.section.0.pop();
                    }
                    if values.len() == 1 {
                        let value = values.pop().expect("vec is non-empty but popped to empty value");
                        return Some((k, normalize_cow(value)));
                    }
                    return Some((
                        k,
                        normalize_vec(values.into_iter().rev().flat_map(|v: Cow<[u8]>| v.to_vec()).collect()),
                    ));
                }
                Event::Value(v) | Event::ValueNotDone(v) | Event::ValueDone(v) => values.push(v),
                _ => (),
            }
        }
        None
    }
pub fn pop ( & mut self ) -> Option < ( Key , Cow < ' event , [ u8 ] > ) > { let mut values = vec ! [ ] ; // events are popped in reverse order while let Some ( e ) = self . section . 0 . pop ( ) { match e { Event :: Key ( k ) => { // pop leading whitespace if let Some ( Event :: Whitespace ( _ ) ) = self . section . 0 . last ( ) { self . section . 0 . pop ( ) ; } if values . len ( ) == 1 { let value = values . pop ( ) . expect ( " " ) ; return Some ( ( k , normalize_cow ( value ) ) ) ; } return Some ( ( k , normalize_vec ( values . into_iter ( ) . rev ( ) . flat_map ( | v : Cow < [ u8 ] > | v . to_vec ( ) ) . collect ( ) ) , ) ) ; } Event :: Value ( v ) | Event :: ValueNotDone ( v ) | Event :: ValueDone ( v ) => values . push ( v ) , _ => ( ) , } } None }
Removes all events until a key value pair is removed.
Removes all events until a key value pair is removed .
&mut self