diff options
Diffstat (limited to 'CLI/rust/src/game_of_life/simulation/plane.rs')
| -rw-r--r-- | CLI/rust/src/game_of_life/simulation/plane.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/CLI/rust/src/game_of_life/simulation/plane.rs b/CLI/rust/src/game_of_life/simulation/plane.rs index 76d91fb..21c34cf 100644 --- a/CLI/rust/src/game_of_life/simulation/plane.rs +++ b/CLI/rust/src/game_of_life/simulation/plane.rs @@ -6,11 +6,11 @@ use std::ops::{Index, IndexMut}; /// This is used internally in the implementation of the Universe to allow /// more readable and safer traversing of the universe blocks #[derive(Debug, Clone, PartialEq)] -pub(crate) struct Plane(pub Vec<bool>); +pub(crate) struct Plane<T>(pub Vec<T>); -impl Index<isize> for Plane { - type Output = bool; - fn index(&self, idx: isize) -> &bool { +impl<T> Index<isize> for Plane<T> { + type Output = T; + fn index(&self, idx: isize) -> &T { let len = self.0.len() as isize; &self.0[circular_index(idx, len)] } @@ -34,7 +34,7 @@ mod index { } } -impl IndexMut<isize> for Plane { +impl<T> IndexMut<isize> for Plane<T> { fn index_mut(&mut self, idx: isize) -> &mut Self::Output { let len = self.0.len() as isize; &mut self.0[circular_index(idx, len)] |
