fn _lookup<S, F: Fn(&S, &Region) -> bool>(
        &self,
        shape: &S,
        pred: F,
        index: Index,
    ) -> Vec<Index> {
        let mut hits = Vec::new();
        let mut work_queue = vec![index];

        'work_loop: while let Some(index) = work_queue.pop() {
            let node = self.get_node(index);

            // If we're at a leaf node, then add it to our hits vector.
            if node.is_leaf() {
                hits.push(index);
                continue 'work_loop;
            }

            // Otherwise iterate over the children of this node, extending `work_queue`
            // by any children where `pref` whose bounding box contains region`.
            for (child_index, child_node) in self.child_iter(index) {
                if pred(shape, child_node.get_region()) {
                    work_queue.push(child_index);
                }
            }
        }

        hits
    }
/// Searches the tree for any leaves containing the input shape `shape`.
/// `pred` should be a function `Fn(shape: &S, region: &Region) -> bool` indicating whether
/// whether we should recurse into `region`.  Some examples of `pred` could be:
/// - Check whether `shape` is contained in region,
/// - Check whether `shape` and `region` overlap
Searches the tree for any leaves containing the input shape `shape`.
Searches the tree for any leaves containing the input shape ` shape ` .
fn _lookup<S, F: Fn(&S, &Region) -> bool>(
        &self,
        shape: &S,
        pred: F,
        index: Index,
    ) -> Vec<Index> {
        let mut hits = Vec::new();
        let mut work_queue = vec![index];
        'work_loop: while let Some(index) = work_queue.pop() {
            let node = self.get_node(index);
            // If we're at a leaf node, then add it to our hits vector.
            if node.is_leaf() {
                hits.push(index);
                continue 'work_loop;
            }
            // Otherwise iterate over the children of this node, extending `work_queue`
            // by any children where `pref` whose bounding box contains region`.
            for (child_index, child_node) in self.child_iter(index) {
                if pred(shape, child_node.get_region()) {
                    work_queue.push(child_index);
                }
            }
        }
        hits
    }
fn _lookup < S , F : Fn ( & S , & Region ) -> bool > ( & self , shape : & S , pred : F , index : Index , ) -> Vec < Index > { let mut hits = Vec :: new ( ) ; let mut work_queue = vec ! [ index ] ; ' work_loop : while let Some ( index ) = work_queue . pop ( ) { let node = self . get_node ( index ) ; // If we're at a leaf node, then add it to our hits vector. if node . is_leaf ( ) { hits . push ( index ) ; continue ' work_loop ; } // Otherwise iterate over the children of this node, extending `work_queue` // by any children where `pref` whose bounding box contains region`. for ( child_index , child_node ) in self . child_iter ( index ) { if pred ( shape , child_node . get_region ( ) ) { work_queue . push ( child_index ) ; } } } hits }
Searches the tree for any leaves containing the input shape `shape`.
Searches the tree for any leaves containing the input shape ` shape ` .
&self
shape
&S
pred
F
index
Index
&self
shape
&S
pred
F
index
Index