fn explore(tree: HuffmanTree<u64>, depth: u8) -> Vec<(u8, u8, u64)> {
    match tree {
        HuffmanTree::Node { left, right, .. } => {
            let mut summary = explore(*left, depth + 1);
            summary.append(&mut explore(*right, depth + 1));
            summary
        }
        HuffmanTree::Leaf { value, byte } => {
            vec![(depth, byte, value)]
        }
    }
}
/// Helper to build HuffmanCanonical, yields the list of (depth, byte, count).
Helper to build HuffmanCanonical, yields the list of (depth, byte, count).
Helper to build HuffmanCanonical yields the list of ( depth byte count ) .
fn explore(tree: HuffmanTree<u64>, depth: u8) -> Vec<(u8, u8, u64)> {
    match tree {
        HuffmanTree::Node { left, right, .. } => {
            let mut summary = explore(*left, depth + 1);
            summary.append(&mut explore(*right, depth + 1));
            summary
        }
        HuffmanTree::Leaf { value, byte } => {
            vec![(depth, byte, value)]
        }
    }
}
fn explore ( tree : HuffmanTree < u64 > , depth : u8 ) -> Vec < ( u8 , u8 , u64 ) > { match tree { HuffmanTree :: Node { left , right , .. } => { let mut summary = explore ( * left , depth + 1 ) ; summary . append ( & mut explore ( * right , depth + 1 ) ) ; summary } HuffmanTree :: Leaf { value , byte } => { vec ! [ ( depth byte value ) ] } } }
Helper to build HuffmanCanonical, yields the list of (depth, byte, count).
Helper to build HuffmanCanonical yields the list of ( depth byte count ) .
tree
HuffmanTree<u64>
depth
u8
tree
HuffmanTree<u64>
depth
u8