pub fn prev(&mut self) -> bool {
        match &mut self.leaf {
            Some(_) => {
                let idx = self.index_stack.last_mut().unwrap();
                if 0 < *idx {
                    *idx -= 1;

                    true
                } else {
                    for (i, idx) in self.index_stack.iter_mut().enumerate().rev().skip(1) {
                        if 0 < *idx {
                            *idx -= 1;
                            self.leaf = None;

                            while i + 1 < self.node_stack.len() {
                                self.node_stack.pop();
                            }
                            while i + 1 < self.index_stack.len() {
                                self.index_stack.pop();
                            }
                            return true;
                        }
                    }

                    false
                }
            }
            None => {
                loop {
                    let node = *self.node_stack.last().unwrap();
                    let idx = *self.index_stack.last().unwrap();

                    match node.children() {
                        ChildrenSlice::Nodes(children) => {
                            let child = children[idx].as_ref();
                            self.node_stack.push(child).assert_none();
                            self.index_stack
                                .push(child.num_children() - 1)
                                .assert_none();
                        }
                        ChildrenSlice::Leafs(children) => {
                            let child = children[idx].as_ref();
                            self.leaf = Some(child);
                            self.index_stack.push(child.len() - 1).assert_none();
                            break;
                        }
                    }
                }

                true
            }
        }
    }
/// Returns `true` if successfully moved to the previous entry, `false` otherwise (you're on the first entry).
Returns `true` if successfully moved to the previous entry, `false` otherwise (you're on the first entry).
Returns ` true ` if successfully moved to the previous entry ` false ` otherwise ( you ' re on the first entry ) .
pub fn prev(&mut self) -> bool {
        match &mut self.leaf {
            Some(_) => {
                let idx = self.index_stack.last_mut().unwrap();
                if 0 < *idx {
                    *idx -= 1;
                    true
                } else {
                    for (i, idx) in self.index_stack.iter_mut().enumerate().rev().skip(1) {
                        if 0 < *idx {
                            *idx -= 1;
                            self.leaf = None;
                            while i + 1 < self.node_stack.len() {
                                self.node_stack.pop();
                            }
                            while i + 1 < self.index_stack.len() {
                                self.index_stack.pop();
                            }
                            return true;
                        }
                    }
                    false
                }
            }
            None => {
                loop {
                    let node = *self.node_stack.last().unwrap();
                    let idx = *self.index_stack.last().unwrap();
                    match node.children() {
                        ChildrenSlice::Nodes(children) => {
                            let child = children[idx].as_ref();
                            self.node_stack.push(child).assert_none();
                            self.index_stack
                                .push(child.num_children() - 1)
                                .assert_none();
                        }
                        ChildrenSlice::Leafs(children) => {
                            let child = children[idx].as_ref();
                            self.leaf = Some(child);
                            self.index_stack.push(child.len() - 1).assert_none();
                            break;
                        }
                    }
                }
                true
            }
        }
    }
pub fn prev ( & mut self ) -> bool { match & mut self . leaf { Some ( _ ) => { let idx = self . index_stack . last_mut ( ) . unwrap ( ) ; if 0 < * idx { * idx -= 1 ; true } else { for ( i , idx ) in self . index_stack . iter_mut ( ) . enumerate ( ) . rev ( ) . skip ( 1 ) { if 0 < * idx { * idx -= 1 ; self . leaf = None ; while i + 1 < self . node_stack . len ( ) { self . node_stack . pop ( ) ; } while i + 1 < self . index_stack . len ( ) { self . index_stack . pop ( ) ; } return true ; } } false } } None => { loop { let node = * self . node_stack . last ( ) . unwrap ( ) ; let idx = * self . index_stack . last ( ) . unwrap ( ) ; match node . children ( ) { ChildrenSlice :: Nodes ( children ) => { let child = children [ idx ] . as_ref ( ) ; self . node_stack . push ( child ) . assert_none ( ) ; self . index_stack . push ( child . num_children ( ) - 1 ) . assert_none ( ) ; } ChildrenSlice :: Leafs ( children ) => { let child = children [ idx ] . as_ref ( ) ; self . leaf = Some ( child ) ; self . index_stack . push ( child . len ( ) - 1 ) . assert_none ( ) ; break ; } } } true } } }
Returns `true` if successfully moved to the previous entry, `false` otherwise (you're on the first entry).
Returns ` true ` if successfully moved to the previous entry ` false ` otherwise ( you ' re on the first entry ) .
&mut self
&mut self