Struct sudoku_variants::constraint::CompositeConstraint[][src]

pub struct CompositeConstraint<C1, C2> where
    C1: Constraint + Clone + 'static,
    C2: Constraint + Clone + 'static, 
{ /* fields omitted */ }

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]

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]

impl<C1, C2> Constraint for CompositeConstraint<C1, C2> where
    C1: Constraint + Clone + 'static,
    C2: Constraint + Clone + 'static, 
[src]

Auto Trait Implementations

impl<C1, C2> RefUnwindSafe for CompositeConstraint<C1, C2> where
    C1: RefUnwindSafe,
    C2: RefUnwindSafe

impl<C1, C2> Send for CompositeConstraint<C1, C2> where
    C1: Send,
    C2: Send

impl<C1, C2> Sync for CompositeConstraint<C1, C2> where
    C1: Sync,
    C2: Sync

impl<C1, C2> Unpin for CompositeConstraint<C1, C2> where
    C1: Unpin,
    C2: Unpin

impl<C1, C2> UnwindSafe for CompositeConstraint<C1, C2> where
    C1: UnwindSafe,
    C2: UnwindSafe

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<C> CloneConstraint for C where
    C: 'static + Constraint + Clone
[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, 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<V, T> VZip<V> for T where
    V: MultiLane<T>,