home projects blog links contact
· open repo · rust


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


I was trying to implement Game of life in rust, and I needed a way to store the grid in memory. I made a huge grid and it overflowed the stack, so I made a cool library to store it in a 2D Vec.

I later found out that better ones already exist, but it was too late. At least I made and published a crate for the first time - it was fun.


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();

go home · all projects