I'm trying to learn rust from the tutorial. I thought Conway's game of life would be a good place to start.
I'm having trouble understanding how to write this Grid::new() fn.
Here's what I have so far:
enum Cell {
alive, dead
}
impl Cell {
fn new() -> Cell {
alive
}
struct Grid {
priv inner: [ [Cell, .. GRID_SIZE], .. GRID_SIZE],
}
impl Grid {
fn new() {
Grid { inner: ???? }
}
}
...
fn main () {
let grid = Grid::new(); // Stack allocated grid (internal stack allocad array)
}
What I want is for the grid to be initialized with cells all of the value 'alive'.