Skip to content

Commit 98dbe6d

Browse files
authored
feat: add getter methods on fields of Constraint (#122)
1 parent d6384d8 commit 98dbe6d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/constraint.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,21 @@ impl Constraint {
2929
self.name = Some(name);
3030
self
3131
}
32+
33+
/// The expression that is constrained to be null or negative
34+
pub fn expression(&self) -> &Expression {
35+
&self.expression
36+
}
37+
38+
/// if is_equality, represents expression == 0, otherwise, expression <= 0
39+
pub fn is_equality(&self) -> bool {
40+
self.is_equality
41+
}
42+
43+
/// get the constraint name, if it exists.
44+
pub fn name(&self) -> Option<&str> {
45+
self.name.as_deref()
46+
}
3247
}
3348

3449
impl FormatWithVars for Constraint {

0 commit comments

Comments
 (0)