Expand description

A grid that stores it’s internal data in a Vec. The size of the grid is constant and elements cannot be removed, only changed. Provides very fast iteration and access speed.

Elements can be inserted and accessed via their 1d index, 2d index, or read/modified via iterators.


use sark_grids::grid::Grid;

let mut grid = Grid::default([10,10]);

grid[0] = 'a';
grid[ [1,0] ] = 'b';

assert_eq!('a', grid[0]);
assert_eq!('b', grid[ [1,0] ]);

grid.insert_column_at([3,2], "hello".chars());
let hello: String = grid.column_iter(3).skip(2).take(5).collect();

assert_eq!("hello", hello);


A dense sized grid that stores it’s elements in a Vec.