pubgrub/term
Terms represent positive or negative constraints over ranges.
Types
Relationship between two terms.
pub type Relation {
Satisfied
Contradicted
Inconclusive
}
Constructors
-
Satisfied -
Contradicted -
Inconclusive
A constraint over versions.
pub type Term(v) {
Positive(version_ranges.Ranges(v))
Negative(version_ranges.Ranges(v))
}
Constructors
-
Positive(version_ranges.Ranges(v)) -
Negative(version_ranges.Ranges(v))
Values
pub fn compare(term: Term(v)) -> fn(v, v) -> order.Order
Extract the compare function carried by a term.
pub fn contains(term: Term(v), version: v) -> Bool
Check whether a version is allowed by the term.
pub fn empty(compare: fn(v, v) -> order.Order) -> Term(v)
A term that accepts no versions.
pub fn equal(left: Term(v), right: Term(v)) -> Bool
True when two terms have the same polarity and range set.
pub fn exact(
compare: fn(v, v) -> order.Order,
version: v,
) -> Term(v)
A term that accepts exactly one version.
pub fn relation_with(
term: Term(v),
other_terms_intersection: Term(v),
) -> Relation
Relation between a term and the intersection of other terms.
pub fn to_string(
term: Term(v),
range_to_string: fn(version_ranges.Ranges(v)) -> String,
) -> String
Render a term using a range formatter.
pub fn unwrap_negative(term: Term(v)) -> version_ranges.Ranges(v)
Extract the negative range set or panic.
pub fn unwrap_positive(term: Term(v)) -> version_ranges.Ranges(v)
Extract the positive range set or panic.