Enum recital::resolve::Constraints [] [src]

pub enum Constraints {
    And(Vec<Box<Constraint>>),
    Or(Vec<Box<Constraint>>),
}

Represents a set of constraints.

The following example will allow any version number from 1.0.0 to less than 2.0.0 while also skipping 1.4.5, which we can say to be a buggy release.

use recital::resolve::Constraint;
use recital::resolve::Constraints::And;
use recital::resolve::Operation::*;

let set = And(vec![Box::new(GreaterThanOrEqualTo(version!(1, 0, 0))),
                   Box::new(ExactlyNot(version!(1, 4, 5))),
                   Box::new(LessThan(version!(2, 0, 0)))]);

if set.allows(&version!(1, 4, 6)) {
    // ... allowed ...
}

if !set.allows(&version!(1, 4, 5)) {
    // ... not allowed ...
}

Variants

All constraints must be satisified.

At least one constraint must be satisified.

Trait Implementations

impl Constraint for Constraints
[src]

Checks if the given version number satisifies this constraint.