[][src]Struct msolve::Sudoku

pub struct Sudoku { /* fields omitted */ }

Structure that represents a sudoku

Implementations

impl Sudoku[src]

pub fn to_array(&self) -> [u8; 81][src]

Convert the sudoku into a [u8; 81] containing the numerical form of each solved square

pub fn to_bytes(&self) -> [u8; 81][src]

pub fn iter(self) -> SolutionIterator[src]

Returns an iterator over all solutions

pub fn solve_one(self) -> Option<Self>[src]

Get the first solution.

pub fn solve_unique(self) -> Option<Self>[src]

Returns the first solution if it is uniquely solvable, otherwise returns None

pub fn count_solutions(self, n: usize) -> usize[src]

Counts the number of solutions, up to maximum of n

pub fn has_single_solution(self) -> bool[src]

Check whether the sudoku has exactly one solution without returning the solution

pub fn has_solution(self) -> bool[src]

pub const fn empty() -> Self[src]

Returns an empty sudoku grid, alternative to Sudoku::from([0; 81]) or Sudoku::from(vec![])

pub fn solve_difficulty(self) -> usize[src]

Returns the number of steps to find the first solution, approximately proportional to difficulty

pub fn solve_unique_difficulty(self) -> usize[src]

Returns the number of steps to find the first two solutions, approximately proportional to difficulty

Trait Implementations

impl Clone for Sudoku[src]

impl Copy for Sudoku[src]

impl Debug for Sudoku[src]

impl Display for Sudoku[src]

impl FromStr for Sudoku[src]

type Err = InvalidSudoku

The associated error which can be returned from parsing.

impl<'_, T: TryInto<u32> + Copy> TryFrom<&'_ [T; 81]> for Sudoku[src]

type Error = InvalidSudoku

The type returned in the event of a conversion error.

impl<'_, T: TryInto<u32> + Copy> TryFrom<&'_ [T]> for Sudoku[src]

type Error = InvalidSudoku

The type returned in the event of a conversion error.

impl<'_, T: TryInto<u32> + Copy> TryFrom<&'_ Vec<T>> for Sudoku[src]

type Error = InvalidSudoku

The type returned in the event of a conversion error.

impl<T: TryInto<u32> + Copy> TryFrom<[T; 81]> for Sudoku[src]

type Error = InvalidSudoku

The type returned in the event of a conversion error.

impl<T: TryInto<u32> + Copy> TryFrom<Vec<T>> for Sudoku[src]

type Error = InvalidSudoku

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for Sudoku

impl Send for Sudoku

impl Sync for Sudoku

impl Unpin for Sudoku

impl UnwindSafe for Sudoku

Blanket Implementations

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

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

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

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

impl<T, U> Into<U> for T where
    U: From<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> 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.