()
| 120 | |
| 121 | fn main() { |
| 122 | fn basic_test() { |
| 123 | let mut list = List::new(); |
| 124 | list.push(1); list.push(2); list.push(3); |
| 125 | assert_eq!(list.pop(), Some(3)); |
| 126 | assert_eq!(list.peek(), Some(&2)); |
| 127 | assert_eq!(list.peek_mut(), Some(&mut 2)); |
| 128 | list.peek_mut().map(|val| { |
| 129 | *val = 4; |
| 130 | }); |
| 131 | assert_eq!(list.peek(), Some(&4)); |
| 132 | println!("basics test Ok!"); |
| 133 | } |
| 134 | |
| 135 | fn into_iter_test() { |
| 136 | let mut list = List::new(); |