Struct sudoku_variants::constraint::CompositeConstraint [−][src]
A Constraint which simultaneously enforces two other constraints. This allows the construction of complex constraints by nesting composite constraints.
As an example, a constraint with DefaultConstraint, DiagonalsConstraint, and KnightsMoveConstraint would be constructed as follows:
use sudoku_variants::constraint::{ CompositeConstraint, DefaultConstraint, DiagonalsConstraint, KnightsMoveConstraint }; let constraint = CompositeConstraint::new( DefaultConstraint, CompositeConstraint::new( DiagonalsConstraint, KnightsMoveConstraint ) );
The advantage of using this over a DynamicConstraint is that it is
statically known which types of constraints are used, so no dynamic
dispatch is necessary. On the contrary, a CompositeConstraint
is less
flexible.
Implementations
impl<C1, C2> CompositeConstraint<C1, C2> where
C1: Constraint + Clone + 'static,
C2: Constraint + Clone + 'static,
[src]
C1: Constraint + Clone + 'static,
C2: Constraint + Clone + 'static,
pub fn new(c1: C1, c2: C2) -> CompositeConstraint<C1, C2>
[src]
Creates a new composite constraint from the two child consraints which will be enforced.
Trait Implementations
impl<C1: Clone, C2: Clone> Clone for CompositeConstraint<C1, C2> where
C1: Constraint + Clone + 'static,
C2: Constraint + Clone + 'static,
[src]
C1: Constraint + Clone + 'static,
C2: Constraint + Clone + 'static,
fn clone(&self) -> CompositeConstraint<C1, C2>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<C1, C2> Constraint for CompositeConstraint<C1, C2> where
C1: Constraint + Clone + 'static,
C2: Constraint + Clone + 'static,
[src]
C1: Constraint + Clone + 'static,
C2: Constraint + Clone + 'static,
fn check(&self, grid: &SudokuGrid) -> bool
[src]
fn check_cell(&self, grid: &SudokuGrid, column: usize, row: usize) -> bool
[src]
fn check_number(
&self,
grid: &SudokuGrid,
column: usize,
row: usize,
number: usize
) -> bool
[src]
&self,
grid: &SudokuGrid,
column: usize,
row: usize,
number: usize
) -> bool
fn get_groups(&self, grid: &SudokuGrid) -> Vec<Group>
[src]
Auto Trait Implementations
impl<C1, C2> RefUnwindSafe for CompositeConstraint<C1, C2> where
C1: RefUnwindSafe,
C2: RefUnwindSafe,
C1: RefUnwindSafe,
C2: RefUnwindSafe,
impl<C1, C2> Send for CompositeConstraint<C1, C2> where
C1: Send,
C2: Send,
C1: Send,
C2: Send,
impl<C1, C2> Sync for CompositeConstraint<C1, C2> where
C1: Sync,
C2: Sync,
C1: Sync,
C2: Sync,
impl<C1, C2> Unpin for CompositeConstraint<C1, C2> where
C1: Unpin,
C2: Unpin,
C1: Unpin,
C2: Unpin,
impl<C1, C2> UnwindSafe for CompositeConstraint<C1, C2> where
C1: UnwindSafe,
C2: UnwindSafe,
C1: UnwindSafe,
C2: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<C> CloneConstraint for C where
C: 'static + Constraint + Clone,
[src]
C: 'static + Constraint + Clone,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,