Module recital::resolve
[−]
[src]
Creates and applies constraints for semantic version numbers.
The resolve module provides you with a default set of constraints,
as well as an enum
that will allow you to chain multiple constraints
together.
It can be as simple as
use recital::resolve::Constraint; use recital::resolve::Operation::GreaterThan; if GreaterThan(version!(1, 0, 0)).allows(&version!(1, 0, 0)) { // ... allowed ... }
or as complicated as
use recital::resolve::Constraint; use recital::resolve::Operation::*; use recital::resolve::resolve; let constraints = constraints!(Or, constraints!(And, GreaterThanOrEqualTo(version!(1, 0, 0)), LessThan(version!(1, 5, 4))), constraints!(And, GreaterThan(version!(1, 5, 4)), LessThan(version!(2, 0, 0)))); let pool = vec![version!(1, 0, 0), version!(1, 1, 0), version!(1, 2, 0), version!(1, 2, 1), version!(1, 3, 0), version!(1, 4, 0), version!(2, 0, 0), version!(2, 0, 1), version!(2, 1, 0)]; let allowed = resolve(&pool, &constraints);
As you can probably tell, the macros make this easy and concise.
Enums
Constraints |
Represents a set of constraints. |
Operation |
A version number constraint as an equality and inequality check. |
Traits
Constraint |
Defines how a constraint must be implemented. |
Functions
resolve |
Resolves a set of constraints against a pool of version numbers. |