grid_sim/world/cell.rs
1#[derive(PartialEq, Eq, Hash, Debug, Clone)]
2pub enum CellState {
3 Live,
4 Dead,
5 Uninitialized,
6 OOB,
7}
8pub struct Cell {
9 xy: (u64, u64),
10 state: CellState,
11}
12impl Cell {
13 pub fn new(xy: (u64, u64), init: CellState) -> Self {
14 Cell { xy: xy, state: init }
15 }
16 pub fn set_state(&mut self, new: CellState) {
17 self.state = new;
18 }
19 pub fn get_state(&self) -> &CellState {
20 &self.state
21 }
22 pub fn get_xy(&self) -> (u64, u64) {
23 self.xy
24 }
25}