Commit 822816e4 authored by Scott Abbey's avatar Scott Abbey

Add structs and enums for ranges

parent 4200e108
use regex::Regex;
use version::Identifier;
lazy_static! {
static ref REGEX: Regex = {
......@@ -48,3 +49,32 @@ lazy_static! {
regex.unwrap()
};
}
pub struct VersionReq {
pub predicates: Vec<Predicate>,
}
pub enum WildcardVersion {
Major,
Minor,
Patch,
}
pub enum Op {
Ex, // Exact
Gt, // Greater than
GtEq, // Greater than or equal to
Lt, // Less than
LtEq, // Less than or equal to
Tilde, // e.g. ~1.0.0
Compatible, // compatible by definition of semver, indicated by ^
Wildcard(WildcardVersion), // x.y.*, x.*, *
}
pub struct Predicate {
op: Op,
major: u64,
minor: Option<u64>,
patch: Option<u64>,
pre: Vec<Identifier>,
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment