use std::rc::Rc;

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

use List::{Node, Tail};

fn main() {
    let list_1 = Rc::new(Node(100,
        Rc::new(Node(110,
            Rc::new(Tail)
        ))
    ));
    println!("list_1 Rc count: {}", Rc::strong_count(&list_1));
    let list_2 = Node(200, Rc::clone(&list_1));
    println!("list_1 Rc count: {}", Rc::strong_count(&list_1));
    {
        let list_3 = Node(300, Rc::clone(&list_1));
        println!("list_1 Rc count: {}", Rc::strong_count(&list_1));
    }
    println!("list_1 Rc count: {}", Rc::strong_count(&list_1));
}
