Trait puzzle_solver::constraint::Constraint
[−]
[src]
pub trait Constraint { fn vars<'a>(&'a self) -> Box<Iterator<Item = &'a VarToken> + 'a>; fn substitute(
&self,
from: VarToken,
to: VarToken
) -> PsResult<Rc<Constraint>>; fn on_assigned(
&self,
_search: &mut PuzzleSearch,
_var: VarToken,
_val: Val
) -> PsResult<()> { ... } fn on_updated(&self, _search: &mut PuzzleSearch) -> PsResult<()> { ... } }
Constraint trait.
Required Methods
fn vars<'a>(&'a self) -> Box<Iterator<Item = &'a VarToken> + 'a>
An iterator over the variables that are involved in the constraint.
fn substitute(&self, from: VarToken, to: VarToken) -> PsResult<Rc<Constraint>>
Substitute the "from" variable with the "to" variable.
Returns a new constraint with all instances of "from" replaced with "to", or Err if a contradiction was found.
Provided Methods
fn on_assigned(
&self,
_search: &mut PuzzleSearch,
_var: VarToken,
_val: Val
) -> PsResult<()>
&self,
_search: &mut PuzzleSearch,
_var: VarToken,
_val: Val
) -> PsResult<()>
Applied after a variable has been assigned.
fn on_updated(&self, _search: &mut PuzzleSearch) -> PsResult<()>
Applied after a variable's candidates has been modified.
Implementors
impl Constraint for AllDifferent
impl Constraint for Equality
impl Constraint for Unify