pub trait Constraint:
Display
+ Debug
+ Send
+ Sync {
// Required methods
fn matches(&self, other: &dyn Constraint) -> bool;
fn lower_bound(&self) -> Bound;
fn upper_bound(&self) -> Bound;
// Provided methods
fn pretty_string(&self) -> String { ... }
fn set_pretty_string(&mut self, _pretty: String) { ... }
fn is_match_all(&self) -> bool { ... }
fn is_match_none(&self) -> bool { ... }
fn as_single(&self) -> Option<&SingleConstraint> { ... }
fn as_multi(&self) -> Option<&MultiConstraint> { ... }
}Expand description
Core trait for all constraint types.
Required Methods§
Sourcefn matches(&self, other: &dyn Constraint) -> bool
fn matches(&self, other: &dyn Constraint) -> bool
Check if this constraint matches/intersects with another.
Sourcefn lower_bound(&self) -> Bound
fn lower_bound(&self) -> Bound
Get the lower bound of this constraint.
Sourcefn upper_bound(&self) -> Bound
fn upper_bound(&self) -> Bound
Get the upper bound of this constraint.
Provided Methods§
Sourcefn pretty_string(&self) -> String
fn pretty_string(&self) -> String
Get a human-readable representation.
Sourcefn set_pretty_string(&mut self, _pretty: String)
fn set_pretty_string(&mut self, _pretty: String)
Set a custom pretty string (for preserving user input).
Sourcefn is_match_all(&self) -> bool
fn is_match_all(&self) -> bool
Check if this is a MatchAllConstraint.
Sourcefn is_match_none(&self) -> bool
fn is_match_none(&self) -> bool
Check if this is a MatchNoneConstraint.
Sourcefn as_single(&self) -> Option<&SingleConstraint>
fn as_single(&self) -> Option<&SingleConstraint>
Try to downcast to SingleConstraint.
Sourcefn as_multi(&self) -> Option<&MultiConstraint>
fn as_multi(&self) -> Option<&MultiConstraint>
Try to downcast to MultiConstraint.