pub enum Solution {
Impossible,
Unique(SudokuGrid),
Ambiguous,
}
Expand description
An enumeration of the different ways a Sudoku can be solveable. Note that
this may be relative to the solver, since an imperfect solver may be unable
to continue at some point, yielding Solution::Ambiguous
, where the Sudoku
is actually uniquely solveable or impossible.
Variants§
Impossible
Indicates that the Sudoku is not solveable at all.
Unique(SudokuGrid)
Indicates that the Sudoku has a unique solution, which is wrapped in this instance.
Ambiguous
Indicates that the Sudoku has multiple solutions or, at least, that the solver was unable to find a unique one or prove it is impossible.
Implementations§
Source§impl Solution
impl Solution
Sourcepub fn union(self, other: Solution) -> Solution
pub fn union(self, other: Solution) -> Solution
Computes the union of two solutions. This is defined as follows:
- If one solution is
Solution::Impossible
, the other one is returned. - If one solution is
Solution::Ambiguous
then the result is also ambiguous - If both solutions are
Solution::Unique
with solution gridsg1
andg2
, then the result isSolution::Unique(g1)
ifg1 == g2
andSolution::Ambiguous
otherwise.
Trait Implementations§
impl Eq for Solution
impl StructuralPartialEq for Solution
Auto Trait Implementations§
impl Freeze for Solution
impl RefUnwindSafe for Solution
impl Send for Solution
impl Sync for Solution
impl Unpin for Solution
impl UnwindSafe for Solution
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