pub struct EqualityConstraint { /* private fields */ }Expand description
Constrains two variables to have the same value.
Used to express variable equality when two positions in a triple
share the same logical variable but need distinct VariableIds
for the TribleSetConstraint
(which assumes its three positions have distinct ids).
The macro layer emits this automatically when a _?var appears in
both the entity and value positions of the same triple.
Implementations§
Source§impl EqualityConstraint
impl EqualityConstraint
Sourcepub fn new(a: VariableId, b: VariableId) -> Self
pub fn new(a: VariableId, b: VariableId) -> Self
Creates a constraint requiring a and b to be bound to the
same raw value.
Trait Implementations§
Source§impl<'c> Constraint<'c> for EqualityConstraint
impl<'c> Constraint<'c> for EqualityConstraint
Source§fn estimate(&self, variable: VariableId, binding: &Binding) -> Option<usize>
fn estimate(&self, variable: VariableId, binding: &Binding) -> Option<usize>
Returns Some(1) when the peer variable is already bound
(exactly one candidate). Returns None when the peer is
unbound — the constraint has no independent opinion about the
variable’s cardinality and defers to other constraints in the
intersection. This is safe as long as each variable also appears
in at least one other constraint (which the macro desugaring
guarantees).
Source§fn propose(
&self,
variable: VariableId,
binding: &Binding,
proposals: &mut Vec<RawValue>,
)
fn propose( &self, variable: VariableId, binding: &Binding, proposals: &mut Vec<RawValue>, )
When the peer variable is bound, proposes its 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 peer variable’s binding.
Source§fn satisfied(&self, binding: &Binding) -> bool
fn satisfied(&self, binding: &Binding) -> bool
Returns false when both variables are bound to different values.
Source§fn variables(&self) -> VariableSet
fn variables(&self) -> VariableSet
Source§fn influence(&self, variable: VariableId) -> VariableSet
fn influence(&self, variable: VariableId) -> VariableSet
variable is bound or unbound. Read moreAuto Trait Implementations§
impl Freeze for EqualityConstraint
impl RefUnwindSafe for EqualityConstraint
impl Send for EqualityConstraint
impl Sync for EqualityConstraint
impl Unpin for EqualityConstraint
impl UnsafeUnpin for EqualityConstraint
impl UnwindSafe for EqualityConstraint
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
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>
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>
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