minutae/cell.rs
1//! Declares a single cell of the universe. Each cell has a coordinate that is made up of two unsigned integers and
2//! represents its offset from the top left of the universe. All cells are one variant of a single Enum that represents
3//! all possible variants and states that a cell can take on.
4//!
5//! Every tick of the simulation, a function is evaluated that transforms a cell from its current state into the next
6//! state. Its only inputs are the cell itself and 2-dim array of its neighboring cells as `Option`s to account for
7//! cases where the cell is on the edge of the universe. The size of the the supplied array is dependant on the view
8//! distance of the universe.
9
10use std::clone::Clone;
11
12pub trait CellState:Clone {}
13
14#[derive(Debug)]
15pub struct Cell<CellState> {
16 pub state: CellState,
17}
18
19impl<S> Clone for Cell<S> where S:Clone {
20 fn clone(&self) -> Self {
21 Cell {
22 state: self.state.clone(),
23 }
24 }
25}