(self)
| 27 | } |
| 28 | |
| 29 | pub fn iter(self) -> impl Iterator<Item = I> { |
| 30 | let end = self.end; |
| 31 | let mut counter = self.start; |
| 32 | std::iter::from_fn(move || { |
| 33 | let current = counter; |
| 34 | if current < end { |
| 35 | counter += I::one(); |
| 36 | Some(current) |
| 37 | } else { |
| 38 | None |
| 39 | } |
| 40 | }) |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | /// Trait that has to be implemented for types to be used as background grid cell indices in the context of the library |