pumpkin_core/constraints/
element.rs

1use super::Constraint;
2use crate::proof::ConstraintTag;
3use crate::propagators::element::ElementArgs;
4use crate::variables::IntegerVariable;
5
6/// Creates the [element](https://sofdem.github.io/gccat/gccat/Celement.html) [`Constraint`] which states that `array[index] = rhs`.
7pub fn element<ElementVar: IntegerVariable + 'static>(
8    index: impl IntegerVariable + 'static,
9    array: impl IntoIterator<Item = ElementVar>,
10    rhs: impl IntegerVariable + 'static,
11    constraint_tag: ConstraintTag,
12) -> impl Constraint {
13    ElementArgs {
14        array: array.into_iter().collect(),
15        index,
16        rhs,
17        constraint_tag,
18    }
19}