| Crates.io | range2d |
| lib.rs | range2d |
| version | 0.2.0 |
| created_at | 2025-04-14 05:19:13.385365+00 |
| updated_at | 2025-04-14 05:48:37.140471+00 |
| description | An iterator for traversing a 2D rectangular coordinate space. |
| homepage | https://github.com/sunsided/range2d |
| repository | https://github.com/sunsided/range2d |
| max_upload_size | |
| id | 1632399 |
| size | 33,231 |
range2d — A 2D Range IteratorThis crate provides Range2D, a highly flexible, efficient, and composable iterator
for traversing a 2D rectangular coordinate space.
It yields (y, x) coordinate pairs from a rectangular region defined by two Range<usize> bounds,
visiting each row in order from top to bottom and each column from left to right.
DoubleEndedIterator)ExactSizeIterator).nth()split() for parallel workloadssplit_into(n) for evenly sized chunkschunks_of(n) for fixed-size partitioning.reset()use range2d::Range2D;
fn example() {
let iter = Range2D::new(0..2, 0..3);
let coords: Vec<_> = iter.collect();
assert_eq!(coords, vec![
(0, 0), (0, 1), (0, 2),
(1, 0), (1, 1), (1, 2),
]);
}
This iterator is compatible with all iterator adapters (.rev(), .take(), .map(), etc.),
and behaves predictably when fused or split into subranges.