以下是实现的三种迭代功能 into_iter: 链表改变,成为迭代器 iter: 链表不变,只得到不可变迭代器 iter_mut: 链表不变,得到可变迭代器
(self)
| 65 | // iter: 链表不变,只得到不可变迭代器 |
| 66 | // iter_mut: 链表不变,得到可变迭代器 |
| 67 | pub fn into_iter(self) -> IntoIter<T> { |
| 68 | IntoIter(self) |
| 69 | } |
| 70 | |
| 71 | pub fn iter(&self) -> Iter<T> { |
| 72 | Iter { next: self.head.as_deref() } |
no test coverage detected