pub struct ConstantConstraint { /* private fields */ }Expand description
Pins a variable to a single known value.
Created by Variable::is. The estimate is always 1, propose yields
exactly the constant, and confirm retains only matching proposals.
This is the simplest possible constraint and is used by the macro
layer to bind attribute IDs and literal values.
Implementations§
Source§impl ConstantConstraint
impl ConstantConstraint
Sourcepub fn new<T: ValueSchema>(variable: Variable<T>, constant: Value<T>) -> Self
pub fn new<T: ValueSchema>(variable: Variable<T>, constant: Value<T>) -> Self
Creates a constraint that binds variable to constant.
Trait Implementations§
Source§impl<'a> Constraint<'a> for ConstantConstraint
impl<'a> Constraint<'a> for ConstantConstraint
Source§fn estimate(&self, variable: VariableId, _binding: &Binding) -> Option<usize>
fn estimate(&self, variable: VariableId, _binding: &Binding) -> Option<usize>
Always returns Some(1) for the constrained variable.
Source§fn propose(
&self,
variable: VariableId,
_binding: &Binding,
proposals: &mut Vec<RawValue>,
)
fn propose( &self, variable: VariableId, _binding: &Binding, proposals: &mut Vec<RawValue>, )
Pushes the single constant value.
Source§fn confirm(
&self,
variable: VariableId,
_binding: &Binding,
proposals: &mut Vec<RawValue>,
)
fn confirm( &self, variable: VariableId, _binding: &Binding, proposals: &mut Vec<RawValue>, )
Retains only proposals that match the constant exactly.
Source§fn satisfied(&self, binding: &Binding) -> bool
fn satisfied(&self, binding: &Binding) -> bool
Returns false when the variable is bound to a different value.
Source§fn variables(&self) -> VariableSet
fn variables(&self) -> VariableSet
Returns the set of variables this constraint touches. Read more
Source§fn influence(&self, variable: VariableId) -> VariableSet
fn influence(&self, variable: VariableId) -> VariableSet
Returns the set of variables whose estimates may change when
variable is bound or unbound. Read moreAuto Trait Implementations§
impl Freeze for ConstantConstraint
impl RefUnwindSafe for ConstantConstraint
impl Send for ConstantConstraint
impl Sync for ConstantConstraint
impl Unpin for ConstantConstraint
impl UnsafeUnpin for ConstantConstraint
impl UnwindSafe for ConstantConstraint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more