pub enum ConstraintEnum<D: Domain> {
NotEqual(NotEqual),
AllDifferent(AllDifferent),
AllDifferentExcept(AllDifferentExcept<D::Value>),
CageSum(CageSum<D::Value>),
CageProduct(CageProduct<D::Value>),
Custom(Box<dyn Constraint<D>>),
}Expand description
Enum-dispatched constraint storage. Avoids vtable indirection for built-in types.
There is deliberately no Lambda variant: every closure-based constraint
(add_equals, add_less_than, add_greater_than, and external
LambdaConstraints) enters through Custom, which boxes
the dyn Constraint. A devirtualized Lambda arm carried zero
construction sites (Pass-1 R1) and was excised; W10 may re-introduce it
behind profiling if the boxed dispatch shows up hot.
CageSum/CageProduct are the n-ary arithmetic cages (super::cage): their
revise_impls clear the default revise’s 3+-variable blindness wall for
the sum/product shapes (Killer / KenKen). They are parameterized by
D::Value (like AllDifferentExcept) and read their integer values through
a stored fn pointer, so the enum keeps its domain-generic bound — the
variants simply go unconstructed for non-integer domains.