Commit fd4fd04c authored by Scott Abbey's avatar Scott Abbey

Introduce version.rs

parent 06bf1040
extern crate regex;
use regex::Regex;
pub struct Version {
major: u64,
minor: u64,
patch: u64,
}
pub fn parse_version(version: &str) -> Version {
let re = Regex::new(r"(\d+).(\d+).(\d+)").unwrap();
let captures = re.captures(version).unwrap();
Version {
major: captures.at(1).unwrap().parse().unwrap(),
minor: captures.at(2).unwrap().parse().unwrap(),
patch: captures.at(3).unwrap().parse().unwrap(),
}
}
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