()
| 128 | } |
| 129 | |
| 130 | fn peek() { |
| 131 | let mut s = Stack::new(); |
| 132 | s.push(1); s.push(2); s.push(3); |
| 133 | |
| 134 | println!("{:?}", s); |
| 135 | let peek_mut = s.peek_mut(); |
| 136 | if let Some(top) = peek_mut { |
| 137 | *top = 4; |
| 138 | } |
| 139 | |
| 140 | println!("top {:?}", s.peek().unwrap()); |
| 141 | println!("{:?}", s); |
| 142 | } |
| 143 | |
| 144 | fn iter() { |
| 145 | let mut s = Stack::new(); |