1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! 2-dimensional grids with `usize`'d coordinate positions.
//!
//! This crate provides traits and implementations for working with 2-dimensional grids that are
//! indexed by `usize`'d coordinates, i.e. for projects such as 2D games, simulations, pixel
//! rasterization, and more, with a focus on performance and safety.
//!
//! ## Examples
//!
//! ```rust
//! use grixy::{core::Pos, buf::VecGrid, grid::{GridRead, GridWrite}};
//!
//! #[derive(Debug, Clone, Copy, PartialEq, Eq)]
//! enum Tile {
//! Empty,
//! Wall,
//! }
//!
//! let mut grid = VecGrid::new_filled_row_major(10, 10, Tile::Empty);
//! grid.set(Pos::new(5, 5), Tile::Wall).unwrap();
//! assert_eq!(grid.get(Pos::new(0, 0)), Some(&Tile::Empty));
//! assert_eq!(grid.get(Pos::new(5, 5)), Some(&Tile::Wall));
//! assert_eq!(grid.get(Pos::new(11, 0)), None);
//! ```
//!
//! ## Features
//!
//! ### `alloc`
//!
//! Provides additional (but optional) types that use `alloc::vec`.
//!
//! ### `bytemuck`
//!
//! Provides support for using `bytemuck` to eligible `GridBuffer` instances to slices of bytes
pub