enum List {
  Node(i32, Box<List>),
  Tail,
}

use List::{Node, Tail};

fn main() {
    let list = Node(0,
        Box::new(Node(1,
            Box::new(Node(2,
                Box::new(Tail)
            ))
        ))
    );
    let mut l = &list;
    loop {
        match &*l {
            Node(value, next) => {
                println!("Node: {value}");
                l = &next;
            },
            Tail => {
                println!("Tail");
                break;
            },
        }
    }
}
