#grid #2d #graphics #gamedev

rust-grid

Very minimal library to store large grids of any type in memory, with a user-friendly interface

2 releases

0.1.1 Sep 7, 2021
0.1.0 Sep 7, 2021

#1014 in Graphics APIs

MIT license

6KB
141 lines

rust-grid

rust-grid is a very minimal library to store large grids of any type in memory, with a user-friendly interface.

Examples

use rust_grid::*;

fn main() {
    let grid: Grid<bool> = Grid::new(10, 15, false);

    // Two ways to access data
    let (x, y) = (3, 4);
    println!("{}", grid[y][x]);
    println!("{}", grid[(x, y)]);

    // Get the size
    let (width, height) = grid.size();
}

lib.rs:

rust-grid

rust-grid is a very minimal library to store large grids of any type in memory, with a user-friendly interface.

Examples

use rust_grid::*;

fn main() {
    let grid: Grid<bool> = Grid::new(10, 15, false);

    // Two ways to access data
    let (x, y) = (3, 4);
    println!("{}", grid[y][x]);
    println!("{}", grid[(x, y)]);

    // Get the size
    let (width, height) = grid.size();
}

No runtime deps