Struct Equality

Source
pub struct Equality { /* private fields */ }

Implementations§

Source§

impl Equality

Source

pub fn new(eqn: LinExpr) -> Self

Allocate a new Equality constraint.

§Examples
let mut magic_square = puzzle_solver::Puzzle::new();
let vars = magic_square.new_vars_with_candidates_2d(3, 3,
        &[1,2,3,4,5,6,7,8,9]);

puzzle_solver::constraint::Equality::new(
        vars[0][0] + vars[0][1] + vars[0][2] - 15);

Trait Implementations§

Source§

impl Constraint for Equality

Source§

fn vars<'a>(&'a self) -> Box<dyn Iterator<Item = &'a VarToken> + 'a>

An iterator over the variables that are involved in the constraint.
Source§

fn on_assigned( &self, search: &mut PuzzleSearch<'_>, _: VarToken, _: Val, ) -> PsResult<()>

Applied after a variable has been assigned.
Source§

fn on_updated(&self, search: &mut PuzzleSearch<'_>) -> PsResult<()>

Applied after a variable’s candidates has been modified.
Source§

fn substitute( &self, from: VarToken, to: VarToken, ) -> PsResult<Rc<dyn Constraint>>

Substitute the “from” variable with the “to” variable. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.