///
/// A simple non-modifying non-proof-generating lookup.
/// Does not mutate the data structure
///
/// @return Some(value) for value associated with the given key if key is in the tree, and None otherwise
///
A simple non-modifying non-proof-generating lookup.
Does not mutate the data structure
A simple non - modifying non - proof - generating lookup . Does not mutate the data structure
pub fn unauthenticated_lookup(&self, key: &ADKey) -> Option<ADValue> {
        let mut internal_node_fn = |r: &InternalNode, found: bool| {
            if found {
                // left all the way to the leaf
                (r.left.clone(), true)
            } else {
                match (*key).cmp(r.hdr.key.as_ref().unwrap()) {
                    Ordering::Equal =>
                    // found in the tree -- go one step right, then left to the leaf
                    {
                        (r.right.clone(), true)
                    }
                    Ordering::Less =>
                    // going left, not yet found
                    {
                        (r.left.clone(), false)
                    }
                    Ordering::Greater =>
                    // going right, not yet found
                    {
                        (r.right.clone(), false)
                    }
                }
            }
        };
        let mut leaf_fn = |leaf: &LeafNode, found: bool| -> Option<ADValue> {
            if found {
                Some(leaf.value.clone())
            } else {
                None
            }
        };
        self.tree_walk(&mut internal_node_fn, &mut leaf_fn, false)
    }
pub fn unauthenticated_lookup ( & self , key : & ADKey ) -> Option < ADValue > { let mut internal_node_fn = | r : & InternalNode , found : bool | { if found { // left all the way to the leaf ( r . left . clone ( ) , true ) } else { match ( * key ) . cmp ( r . hdr . key . as_ref ( ) . unwrap ( ) ) { Ordering :: Equal => // found in the tree -- go one step right, then left to the leaf { ( r . right . clone ( ) , true ) } Ordering :: Less => // going left, not yet found { ( r . left . clone ( ) , false ) } Ordering :: Greater => // going right, not yet found { ( r . right . clone ( ) , false ) } } } } ; let mut leaf_fn = | leaf : & LeafNode , found : bool | -> Option < ADValue > { if found { Some ( leaf . value . clone ( ) ) } else { None } } ; self . tree_walk ( & mut internal_node_fn , & mut leaf_fn , false ) }
A simple non-modifying non-proof-generating lookup.
A simple non - modifying non - proof - generating lookup .
Some(value) for value associated with the given key if key is in the tree, and None otherwise
Some ( value ) for value associated with the given key if key is in the tree and None otherwise
&self
key
&ADKey