fn find(&self, datom: &Datom) -> (Cursor, Vec<Node<'a>>) {
        let mut node = get_node(self.store, self.root_page);
        let mut indices = Vec::with_capacity(node.level as usize + 1);
        let mut nodes = Vec::with_capacity(node.level as usize + 1);

        loop {
            nodes.push(node.clone());

            // Find the index of the first datom >= the search datom. The
            // default value is one past the last datom: if every datom in the
            // node is smaller than the search datom, the cursor should point
            // past the end.
            let mut index = node.datoms.len();

            for (i, datom_i) in node.datoms.iter().enumerate() {
                match self.comparator.cmp(datom_i, datom, &self.heap) {
                    Ordering::Less => continue,
                    Ordering::Equal | Ordering::Greater => {
                        index = i;
                        break;
                    }
                }
            }

            indices.push(index);

            if node.level == 0 {
                break
            } else {
                let pid = node
                    .next_midpoint(index)
                    .expect("Node at level > 0 must have a final child.");
                node = get_node(self.store, pid);
            }
        }

        // We added the nodes top to bottom, but the cursor expects them in the
        // opposite order, lowest level first, so reverse them.
        indices.reverse();
        nodes.reverse();

        let result = Cursor {
            indices: indices,
        };

        (result, nodes)
    }
/// Locate the first datom that is greater than or equal to the queried one.
///
/// Returns a cursor that points to the datom, which can be used as the
/// lower bound for an iterator. Also returns a vector of nodes that the
/// indices point into.
Locate the first datom that is greater than or equal to the queried one.
Returns a cursor that points to the datom, which can be used as the
lower bound for an iterator. Also returns a vector of nodes that the
indices point into.
Locate the first datom that is greater than or equal to the queried one . Returns a cursor that points to the datom which can be used as the lower bound for an iterator . Also returns a vector of nodes that the indices point into .
fn find(&self, datom: &Datom) -> (Cursor, Vec<Node<'a>>) {
        let mut node = get_node(self.store, self.root_page);
        let mut indices = Vec::with_capacity(node.level as usize + 1);
        let mut nodes = Vec::with_capacity(node.level as usize + 1);
        loop {
            nodes.push(node.clone());
            // Find the index of the first datom >= the search datom. The
            // default value is one past the last datom: if every datom in the
            // node is smaller than the search datom, the cursor should point
            // past the end.
            let mut index = node.datoms.len();
            for (i, datom_i) in node.datoms.iter().enumerate() {
                match self.comparator.cmp(datom_i, datom, &self.heap) {
                    Ordering::Less => continue,
                    Ordering::Equal | Ordering::Greater => {
                        index = i;
                        break;
                    }
                }
            }
            indices.push(index);
            if node.level == 0 {
                break
            } else {
                let pid = node
                    .next_midpoint(index)
                    .expect("Node at level > 0 must have a final child.");
                node = get_node(self.store, pid);
            }
        }
        // We added the nodes top to bottom, but the cursor expects them in the
        // opposite order, lowest level first, so reverse them.
        indices.reverse();
        nodes.reverse();
        let result = Cursor {
            indices: indices,
        };
        (result, nodes)
    }
fn find ( & self , datom : & Datom ) -> ( Cursor , Vec < Node < ' a > > ) { let mut node = get_node ( self . store , self . root_page ) ; let mut indices = Vec :: with_capacity ( node . level as usize + 1 ) ; let mut nodes = Vec :: with_capacity ( node . level as usize + 1 ) ; loop { nodes . push ( node . clone ( ) ) ; // Find the index of the first datom >= the search datom. The // default value is one past the last datom: if every datom in the // node is smaller than the search datom, the cursor should point // past the end. let mut index = node . datoms . len ( ) ; for ( i , datom_i ) in node . datoms . iter ( ) . enumerate ( ) { match self . comparator . cmp ( datom_i , datom , & self . heap ) { Ordering :: Less => continue , Ordering :: Equal | Ordering :: Greater => { index = i ; break ; } } } indices . push ( index ) ; if node . level == 0 { break } else { let pid = node . next_midpoint ( index ) . expect ( " " ) ; node = get_node ( self . store , pid ) ; } } // We added the nodes top to bottom, but the cursor expects them in the // opposite order, lowest level first, so reverse them. indices . reverse ( ) ; nodes . reverse ( ) ; let result = Cursor { indices : indices , } ; ( result , nodes ) }
Locate the first datom that is greater than or equal to the queried one.
Locate the first datom that is greater than or equal to the queried one .
&self
datom
&Datom
&self
datom
&Datom