pub struct NanoBoard { /* private fields */ }
Expand description
NanoBoard
is a Board
implementation that focuses on reducing memory usage, at the
cost of access performance. Each board requires only 41 bytes of memory.
A typical Sudoku board has 81 entries, each ranging from 1-9, plus a “blank” signal (which
sudokul represents as 0). Using an array of u8
s, the NanoBoard
packs two entries
into every u8, with the final entry getting the entire u8 to itself.
Implementations§
Trait Implementations§
Source§impl Board for NanoBoard
impl Board for NanoBoard
Source§fn column(&self, col: usize) -> [u8; 9]
fn column(&self, col: usize) -> [u8; 9]
column
returns the 0-indexed column specified by argument. This reads top-down;
the 0th item in the returned array is the 0th row, to the 8th item in the returned
array being the 8th row.Source§fn entry(&self, row: usize, col: usize) -> u8
fn entry(&self, row: usize, col: usize) -> u8
entry
returns the requested item in the puzzle by coordinates, or row+column. As
always, these rows and columns are zero-indexed.Source§fn row(&self, row: usize) -> [u8; 9]
fn row(&self, row: usize) -> [u8; 9]
row
returns the 0-indexed row specified by argument. This reads left-right;
the 0th item in the returned array is the 0th column, to the 8th item in the returned
array being the 8th column.Source§fn set_entry(&mut self, row: usize, col: usize, value: u8)
fn set_entry(&mut self, row: usize, col: usize, value: u8)
set_entry
inserts a single entry into the board, by row+column.fn square(&self, sq: usize) -> [u8; 9]
Auto Trait Implementations§
impl Freeze for NanoBoard
impl RefUnwindSafe for NanoBoard
impl Send for NanoBoard
impl Sync for NanoBoard
impl Unpin for NanoBoard
impl UnwindSafe for NanoBoard
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