pub struct Grid { /* private fields */ }Expand description
A 2D grid of ternary cells.
Implementations§
Source§impl Grid
impl Grid
Sourcepub fn dimensions(&self) -> (usize, usize)
pub fn dimensions(&self) -> (usize, usize)
Grid dimensions as (rows, cols).
Sourcepub fn get_mut(&mut self, row: usize, col: usize) -> Option<&mut Cell>
pub fn get_mut(&mut self, row: usize, col: usize) -> Option<&mut Cell>
Get a mutable cell reference.
Sourcepub fn set(&mut self, row: usize, col: usize, value: TernaryValue)
pub fn set(&mut self, row: usize, col: usize, value: TernaryValue)
Set a cell value directly.
Sourcepub fn range(&self, r1: usize, c1: usize, r2: usize, c2: usize) -> Vec<&Cell>
pub fn range(&self, r1: usize, c1: usize, r2: usize, c2: usize) -> Vec<&Cell>
Get all cells in a range (inclusive).
Sourcepub fn range_mut(
&mut self,
r1: usize,
c1: usize,
r2: usize,
c2: usize,
) -> Vec<&mut Cell>
pub fn range_mut( &mut self, r1: usize, c1: usize, r2: usize, c2: usize, ) -> Vec<&mut Cell>
Get mutable references to all cells in a range.
Sourcepub fn compute_all_fitness(&mut self)
pub fn compute_all_fitness(&mut self)
Compute default fitness for all cells.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Grid
impl RefUnwindSafe for Grid
impl Send for Grid
impl Sync for Grid
impl Unpin for Grid
impl UnsafeUnpin for Grid
impl UnwindSafe for Grid
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more