3 releases

0.1.2 Dec 21, 2022
0.1.1 Nov 7, 2022
0.1.0 Nov 6, 2022

#23 in #ord

Download history 9/week @ 2024-02-19 27/week @ 2024-02-26 2/week @ 2024-03-04 10/week @ 2024-03-11 1/week @ 2024-03-25 74/week @ 2024-04-01 4/week @ 2024-04-15 4/week @ 2024-04-22

82 downloads per month
Used in prismarine

CC0 license

10KB
195 lines

flexver-rs

A Rust implementation of FlexVer.

Getting It

You can either copy (and rename) lib.rs wholesale into your project, or retrieve it from crates.io like so in Cargo.toml:

[dependencies]
flexver-rs = "0.1.2"

Usage

The crate provides both a compare function and the FlexVer struct. The FlexVer struct implements Ord, and thus supports all of the comparison operations.

fn compare(left: &str, right: &str) -> std::cmp::Ordering; // Type signature

assert_eq!(compare("1.0.0", "1.1.0"), Ordering::Less);

struct FlexVer(&str); // Type signature

assert!(FlexVer("1.0.0") < FlexVer("1.1.0"));

You can find additional examples in the tests section at the bottom of lib.rs.

No runtime deps