pub struct Board { /* private fields */ }
Expand description
A representation of a puzzle or solution.
Implementations§
Source§impl Board
impl Board
Sourcepub fn get_cell(&self, x: usize, y: usize) -> u8
pub fn get_cell(&self, x: usize, y: usize) -> u8
Get the contents of the cell at the given coordinates.
This returns the contents of the cell at column x
and row y
. A zero represents a cell
which is unfilled, otherwise the value will be between 1 and 9 inclusive.
§Example
let board = Board::from(&[
[0, 2, 0, 0, 0, 0, 0, 0, 0], // row 1
[0, 0, 0, 6, 0, 0, 0, 0, 3], // row 2
[0, 7, 4, 0, 8, 0, 0, 0, 0], // row 3
[0, 0, 0, 0, 0, 3, 0, 0, 2], // row 4
[0, 8, 0, 0, 4, 0, 0, 1, 0], // row 5
[6, 0, 0, 5, 0, 0, 0, 0, 0], // row 6
[0, 0, 0, 0, 1, 0, 7, 8, 0], // row 7
[5, 0, 0, 0, 0, 9, 0, 0, 0], // row 8
[0, 0, 0, 0, 0, 0, 0, 4, 0], // row 9
]);
assert_eq!(board.get_cell(1, 0), 2);
Trait Implementations§
Source§impl From<Board> for SolutionIter
From
implementation for SolutionIter
.
impl From<Board> for SolutionIter
From
implementation for SolutionIter
.
impl Copy for Board
impl Eq for Board
impl StructuralPartialEq for Board
Auto Trait Implementations§
impl Freeze for Board
impl RefUnwindSafe for Board
impl Send for Board
impl Sync for Board
impl Unpin for Board
impl UnwindSafe for Board
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