Struct Unify

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

Implementations§

Source§

impl Unify

Source

pub fn new(var1: VarToken, var2: VarToken) -> Self

Allocate a new Unify constraint.

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

let m = vars[4];
puzzle_solver::constraint::Unify::new(m, carry[3]);

Trait Implementations§

Source§

impl Constraint for Unify

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_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
Source§

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

Applied after a variable has been assigned.

Auto Trait Implementations§

§

impl Freeze for Unify

§

impl RefUnwindSafe for Unify

§

impl Send for Unify

§

impl Sync for Unify

§

impl Unpin for Unify

§

impl UnwindSafe for Unify

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.