()
| 35 | } |
| 36 | |
| 37 | fn main() { |
| 38 | let root = Rc::new(RefCell::new(Node::new(0))); |
| 39 | let node = Rc::new(RefCell::new(Node::new(1))); |
| 40 | node.borrow_mut().parent = Some(Rc::downgrade(&root)); |
| 41 | |
| 42 | let node2 = Rc::new(RefCell::new(Node::new(2))); |
| 43 | |
| 44 | root.borrow_mut().parent = Some(Rc::downgrade(&node2)); |
| 45 | root.borrow_mut().left = Some(node); |
| 46 | |
| 47 | println!("Root: {:?}", *root.borrow()); |
| 48 | if let Some(left) = &root.borrow().left { |
| 49 | &left.borrow().print_parent(); |
| 50 | }; |
| 51 | &root.borrow().print_parent(); |
| 52 | drop(node2); |
| 53 | &root.borrow().print_parent(); |
| 54 | } |
nothing calls this directly
no test coverage detected