打印 LVec,当然也可以实习 ToString 特性
(&self)
| 123 | |
| 124 | // 打印 LVec,当然也可以实习 ToString 特性 |
| 125 | fn print_lvec(&self) { |
| 126 | let mut curr = self.head.as_ref(); |
| 127 | while let Some(node) = curr { |
| 128 | println!("lvec val: {:#?}", node.elem); |
| 129 | curr = node.next.as_ref(); |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | fn main() { |