pub enum Constraint {
Unary {
var: String,
predicate: UnaryPredicate,
},
Binary {
var1: String,
var2: String,
relation: BinaryRelation,
},
NAry {
vars: Vec<String>,
relation: NAryRelation,
},
Global {
constraint_type: GlobalConstraintType,
vars: Vec<String>,
params: HashMap<String, i64>,
},
}Expand description
A constraint between variables.
Variants§
Unary
Unary constraint: predicate on single variable
Binary
Binary constraint: relation between two variables
NAry
N-ary constraint: relation among multiple variables
Global
Global constraint: high-level constraint pattern
Implementations§
Source§impl Constraint
impl Constraint
Sourcepub fn less_than(var1: impl Into<String>, var2: impl Into<String>) -> Self
pub fn less_than(var1: impl Into<String>, var2: impl Into<String>) -> Self
Create a binary less-than constraint.
Sourcepub fn sum_equals(vars: Vec<impl Into<String>>, sum: i64) -> Self
pub fn sum_equals(vars: Vec<impl Into<String>>, sum: i64) -> Self
Create an n-ary sum-equals constraint.
Sourcepub fn all_different(vars: Vec<impl Into<String>>) -> Self
pub fn all_different(vars: Vec<impl Into<String>>) -> Self
Create an all-different constraint.
Trait Implementations§
Source§impl Clone for Constraint
impl Clone for Constraint
Source§fn clone(&self) -> Constraint
fn clone(&self) -> Constraint
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Constraint
impl Debug for Constraint
Source§impl<'de> Deserialize<'de> for Constraint
impl<'de> Deserialize<'de> for Constraint
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for Constraint
impl PartialEq for Constraint
Source§impl Serialize for Constraint
impl Serialize for Constraint
impl StructuralPartialEq for Constraint
Auto Trait Implementations§
impl Freeze for Constraint
impl RefUnwindSafe for Constraint
impl Send for Constraint
impl Sync for Constraint
impl Unpin for Constraint
impl UnwindSafe for Constraint
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