Crates.io | version-rs |
lib.rs | version-rs |
version | 0.2.0 |
source | src |
created_at | 2020-07-03 20:48:37.393188 |
updated_at | 2020-08-04 01:26:07.993872 |
description | A struct for Versions, with the methods you expect |
homepage | |
repository | https://github.com/iwahbe/version-rs |
max_upload_size | |
id | 261113 |
size | 9,909 |
Lots of code which handles other pieces of software involves version numbers. This involves creating approximately the same object with approximately the same 100 lines of code in multiple crates. This crate aims to avoid this boilerplate.
Obligatory Example:
use version::Version;
let v1_2_3 = Version::new(1,2,3);
assert!(v1_2_3 == "1.2.3".parse()?);
assert!(v1_2_3 < Version::new(1,2,12));
assert!(v1_2_3 > Version::from((1,2,0));
let (x, y, z) = random_usize_triple();
assert!(Version::from(x,y,z), (x,y,z).into());
Some quick copy and past ensured that Version
works for u8
, u16
, and u32
. To use, add
[dependencies]
version-rs = "0.1"
to your Cargo.toml
. If you want to use Version
with serde, add
version-rs = {version = "0.1", features = ["serde"]}
to derive Serialize
and Deserialize
.