[][src]Struct sudoku_rs::board::Board

pub struct Board { /* fields omitted */ }

board struct

Methods

impl Board[src]

pub fn new() -> Self[src]

pub fn from_vec(vec: Vec<u8>) -> Self[src]

gen board from vec the len of vec must be 81 0 for empty and 1..=9 for value

use sudoku_rs::board::Board;

let b = Board::from_vec(vec![
    0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0,
]);

pub fn unchecked_set(&mut self, x: usize, y: usize, val: u8)[src]

set value in board but not check value will also set bitset

pub fn unchecked_get(&self, x: usize, y: usize) -> Option<u8>[src]

get value return a Option<u8>

pub fn set(&mut self, x: usize, y: usize, val: u8) -> Result<(), SuDoKuError>[src]

set value

pub fn get(&self, x: usize, y: usize) -> Result<Option<u8>, SuDoKuError>[src]

get value

pub fn is_empty(&self, x: usize, y: usize) -> bool[src]

check a solt is empty of not

use sudoku_rs::board::Board;

let mut b = Board::new();
b.set(1, 2, 3).unwrap();
assert!(b.is_empty(1, 1));
assert!(!b.is_empty(1, 2));

pub fn unset(&mut self, x: usize, y: usize)[src]

clear a slot

pub fn avaliable_val(&self, x: usize, y: usize) -> Vec<u8>[src]

get avaliable values for a slot

pub fn avaliable_count(&self, x: usize, y: usize) -> usize[src]

get avaliable values count for a slot

pub fn is_win(&self) -> bool[src]

check if a board is filled

Trait Implementations

impl Default for Board[src]

impl Clone for Board[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Display for Board[src]

impl FromStr for Board[src]

type Err = SuDoKuError

The associated error which can be returned from parsing.

Auto Trait Implementations

impl Send for Board

impl Sync for Board

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]