fn tree_with_three_levels() -> HashTreeBuilderImpl {
    let mut builder = HashTreeBuilderImpl::new();

    builder.start_subtree(); // start subtree at root

    start_subtree("label_a", &mut builder);
    {
        add_leaf("label_a_1", "contents_a_1", &mut builder);
        add_leaf("label_a_2", "contents_a_2", &mut builder);

        start_subtree("label_a_3", &mut builder);
        {
            add_leaf("label_a_3_1", "contents_a_3_1", &mut builder);
            add_leaf("label_a_3_2", "contents_a_3_2", &mut builder);
        }
        builder.finish_subtree(); // finish subtree label_a_3
    }
    builder.finish_subtree(); // finish subtree label_a

    start_subtree("label_b", &mut builder);
    {
        add_leaf("label_b_1", "contents_b_1", &mut builder);

        start_subtree("label_b_2", &mut builder);
        builder.finish_subtree(); // finish subtree label_b_2

        add_leaf("label_b_3", "contents_b_3", &mut builder);

        start_subtree("label_b_4", &mut builder);
        {
            add_leaf("label_b_4_1", "contents_b_4_1", &mut builder);
            add_leaf("label_b_4_2", "contents_b_4_2", &mut builder);
            add_leaf("label_b_4_3", "contents_b_4_3", &mut builder);
        }
        builder.finish_subtree(); // finish subtree label_b_4

        start_subtree("label_b_5", &mut builder);
        {
            add_leaf("label_b_5_1", "contents_b_5_1", &mut builder);
        }
        builder.finish_subtree(); // finish subtree label_b_5
    }
    builder.finish_subtree(); // finish subtree label_b

    add_leaf("label_c", "contents_c", &mut builder);

    builder.finish_subtree(); // finish subtree at root

    builder
}
// Generates a builder with a more complex tree, used for witness tests.
// (root)
//    +-- label_a
//           +-- label_a_1
//                  \__ contents_a_1
//           +-- label_a_2
//                  \__ contents_a_2
//           +-- label_a_3
//                  +-- label_a_3_1
//                          \__ contents_a_3_1
//                  +-- label_a_3_2
//                          \__ contents_a_3_2
//    +-- label_b
//           +-- label_b_1
//                  \__ contents_b_1
//           +-- label_b_2
//                  // empty subtree
//           +-- label_b_3
//                  \__ contents_b_3
//           +-- label_b_4
//                  +-- label_b_4_1
//                          \__ contents_b_4_1
//                  +-- label_b_4_2
//                          \__ contents_b_4_2
//                  +-- label_b_4_3
//                          \__ contents_b_4_3
//           +-- label_b_5
//                  +-- label_b_5_1
//                          \__ contents_b_5_1
//    +-- label_c
//           \__ contents_c
Generates a builder with a more complex tree, used for witness tests.
Generates a builder with a more complex tree used for witness tests .
fn tree_with_three_levels() -> HashTreeBuilderImpl {
    let mut builder = HashTreeBuilderImpl::new();
    builder.start_subtree(); // start subtree at root
    start_subtree("label_a", &mut builder);
    {
        add_leaf("label_a_1", "contents_a_1", &mut builder);
        add_leaf("label_a_2", "contents_a_2", &mut builder);
        start_subtree("label_a_3", &mut builder);
        {
            add_leaf("label_a_3_1", "contents_a_3_1", &mut builder);
            add_leaf("label_a_3_2", "contents_a_3_2", &mut builder);
        }
        builder.finish_subtree(); // finish subtree label_a_3
    }
    builder.finish_subtree(); // finish subtree label_a
    start_subtree("label_b", &mut builder);
    {
        add_leaf("label_b_1", "contents_b_1", &mut builder);
        start_subtree("label_b_2", &mut builder);
        builder.finish_subtree(); // finish subtree label_b_2
        add_leaf("label_b_3", "contents_b_3", &mut builder);
        start_subtree("label_b_4", &mut builder);
        {
            add_leaf("label_b_4_1", "contents_b_4_1", &mut builder);
            add_leaf("label_b_4_2", "contents_b_4_2", &mut builder);
            add_leaf("label_b_4_3", "contents_b_4_3", &mut builder);
        }
        builder.finish_subtree(); // finish subtree label_b_4
        start_subtree("label_b_5", &mut builder);
        {
            add_leaf("label_b_5_1", "contents_b_5_1", &mut builder);
        }
        builder.finish_subtree(); // finish subtree label_b_5
    }
    builder.finish_subtree(); // finish subtree label_b
    add_leaf("label_c", "contents_c", &mut builder);
    builder.finish_subtree(); // finish subtree at root
    builder
}
fn tree_with_three_levels ( ) -> HashTreeBuilderImpl { let mut builder = HashTreeBuilderImpl :: new ( ) ; builder . start_subtree ( ) ; // start subtree at root start_subtree ( " " , & mut builder ) ; { add_leaf ( " " , " " , & mut builder ) ; add_leaf ( " " , " " , & mut builder ) ; start_subtree ( " " , & mut builder ) ; { add_leaf ( " " , " " , & mut builder ) ; add_leaf ( " " , " " , & mut builder ) ; } builder . finish_subtree ( ) ; // finish subtree label_a_3 } builder . finish_subtree ( ) ; // finish subtree label_a start_subtree ( " " , & mut builder ) ; { add_leaf ( " " , " " , & mut builder ) ; start_subtree ( " " , & mut builder ) ; builder . finish_subtree ( ) ; // finish subtree label_b_2 add_leaf ( " " , " " , & mut builder ) ; start_subtree ( " " , & mut builder ) ; { add_leaf ( " " , " " , & mut builder ) ; add_leaf ( " " , " " , & mut builder ) ; add_leaf ( " " , " " , & mut builder ) ; } builder . finish_subtree ( ) ; // finish subtree label_b_4 start_subtree ( " " , & mut builder ) ; { add_leaf ( " " , " " , & mut builder ) ; } builder . finish_subtree ( ) ; // finish subtree label_b_5 } builder . finish_subtree ( ) ; // finish subtree label_b add_leaf ( " " , " " , & mut builder ) ; builder . finish_subtree ( ) ; // finish subtree at root builder }
Generates a builder with a more complex tree, used for witness tests.
Generates a builder with a more complex tree used for witness tests .