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

An iterator over the variables that are involved in the 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

Applied after a variable has been assigned.

Applied after a variable's candidates has been modified.

Implementors