Struct NanoBoard

Source
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 u8s, 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

Source§

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

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]

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)

set_entry inserts a single entry into the board, by row+column.
Source§

fn square(&self, sq: usize) -> [u8; 9]

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.