enum Tree {
    Node(i32, Box<Tree>, Box<Tree>),
    Nil,
}

use Tree::{Node, Nil};

fn display_tree(node: &Tree, depth: usize) {
    match node {
        Node(value, left, right) => {
            println!("{}ノード：{}", " ".repeat(depth * 2), value);
            println!("{}左：", " ".repeat(depth * 2));
            display_tree(left, depth + 1);
            println!("{}右：", " ".repeat(depth * 2));
            display_tree(right, depth + 1);
        },
        Nil => {
            println!("{}なし", " ".repeat(depth * 2));
        },
    }
}

fn main() {
    let tree = Node(1,
        Box::new(Node(11,
            Box::new(Nil),
            Box::new(Nil)
        )),
        Box::new(Node(66,
            Box::new(Nil),
            Box::new(Nil)
        ))
    );
    display_tree(&tree, 0);
}
