pub fn materialize_partial(
    lazy_tree: &LazyTree<'_>,
    pattern: &TreePattern,
) -> Option<LabeledTree<Vec<u8>>> {
    match pattern {
        LabeledTree::Leaf(()) => materialize(lazy_tree),
        LabeledTree::SubTree(children) => {
            if let LazyFork(f) = lazy_tree {
                let subtrees: Vec<_> = children
                    .iter()
                    .filter_map(|(label, pattern)| {
                        let lazy_tree = f.edge(label)?;
                        let t = materialize_partial(&lazy_tree, pattern)?;
                        Some((label.clone(), t))
                    })
                    .collect();

                if subtrees.is_empty() {
                    // Prune empty subtrees
                    None
                } else {
                    Some(LabeledTree::SubTree(FlatMap::from_key_values(subtrees)))
                }
            } else {
                None
            }
        }
    }
}
/// This function provides materializing a LazyTree partially, including only
/// the paths whose prefixes are listed in the pattern (which is itself
/// represented as a LabeledTree, without data in the leaves).
///
/// This is used in the implementation of the `read_state` request, so a
/// specification can be found in the Interface Spec, section on Lookup in
/// certification (https://sdk.dfinity.org/docs/interface-spec/index.html#_lookup)
///
/// The spec requires that the resulting certificate also proves the absence of
/// a prefix; this is not yet implemented. Once it is implemented, remove the
/// corresponding `exclude` directives from `tests/ic-ref-test/run`.
This function provides materializing a LazyTree partially, including only
the paths whose prefixes are listed in the pattern (which is itself
represented as a LabeledTree, without data in the leaves).

This is used in the implementation of the `read_state` request, so a
specification can be found in the Interface Spec, section on Lookup in
certification

The spec requires that the resulting certificate also proves the absence of
a prefix; this is not yet implemented. Once it is implemented, remove the
corresponding `exclude` directives from `tests/ic-ref-test/run`.
This function provides materializing a LazyTree partially including only the paths whose prefixes are listed in the pattern ( which is itself represented as a LabeledTree without data in the leaves ) . This is used in the implementation of the ` read_state ` request so a specification can be found in the Interface Spec section on Lookup in certification The spec requires that the resulting certificate also proves the absence of a prefix ; this is not yet implemented . Once it is implemented remove the corresponding ` exclude ` directives from ` tests / ic - ref - test / run ` .
pub fn materialize_partial(
    lazy_tree: &LazyTree<'_>,
    pattern: &TreePattern,
) -> Option<LabeledTree<Vec<u8>>> {
    match pattern {
        LabeledTree::Leaf(()) => materialize(lazy_tree),
        LabeledTree::SubTree(children) => {
            if let LazyFork(f) = lazy_tree {
                let subtrees: Vec<_> = children
                    .iter()
                    .filter_map(|(label, pattern)| {
                        let lazy_tree = f.edge(label)?;
                        let t = materialize_partial(&lazy_tree, pattern)?;
                        Some((label.clone(), t))
                    })
                    .collect();
                if subtrees.is_empty() {
                    // Prune empty subtrees
                    None
                } else {
                    Some(LabeledTree::SubTree(FlatMap::from_key_values(subtrees)))
                }
            } else {
                None
            }
        }
    }
}
pub fn materialize_partial ( lazy_tree : & LazyTree < ' _ > , pattern : & TreePattern , ) -> Option < LabeledTree < Vec < u8 > > > { match pattern { LabeledTree :: Leaf ( ( ) ) => materialize ( lazy_tree ) , LabeledTree :: SubTree ( children ) => { if let LazyFork ( f ) = lazy_tree { let subtrees : Vec < _ > = children . iter ( ) . filter_map ( | ( label , pattern ) | { let lazy_tree = f . edge ( label ) ? ; let t = materialize_partial ( & lazy_tree , pattern ) ? ; Some ( ( label . clone ( ) , t ) ) } ) . collect ( ) ; if subtrees . is_empty ( ) { // Prune empty subtrees None } else { Some ( LabeledTree :: SubTree ( FlatMap :: from_key_values ( subtrees ) ) ) } } else { None } } } }
This function provides materializing a LazyTree partially, including only
the paths whose prefixes are listed in the pattern (which is itself
represented as a LabeledTree, without data in the leaves).
This function provides materializing a LazyTree partially including only the paths whose prefixes are listed in the pattern ( which is itself represented as a LabeledTree without data in the leaves ) .
lazy_tree
&LazyTree<'_>
pattern
&TreePattern
lazy_tree
&LazyTree<'_>
pattern
&TreePattern