| 105 | |
| 106 | #[inline] |
| 107 | fn nth(&mut self, n: usize) -> Option<Self::Item> { |
| 108 | // Check if we can advance to the desired offset |
| 109 | match self.current.checked_add(n) { |
| 110 | // Yes, and still within bounds |
| 111 | Some(new_current) if new_current < self.current_end => { |
| 112 | self.current = new_current; |
| 113 | } |
| 114 | |
| 115 | // Either overflow or would exceed current_end |
| 116 | _ => { |
| 117 | self.current = self.current_end; |
| 118 | return None; |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | self.next() |
| 123 | } |
| 124 | |
| 125 | #[inline] |
| 126 | fn last(mut self) -> Option<Self::Item> { |