version-lp-rs

A rust library for dealing with versions designed to be used with lovepack tools.

Overview

Contains a custom version Struct that is based on the Semantic Versioning System. Only supports the a.b.c format, but with any number of points, i.e. a.b, a.b.c.d are also valid versions. Also has support for wildcards when compairing Versions.

```rust

let wildversion = Version::fromstr("2..");

Version::fromstring("2.3.4").unwrap().iscompatiblewith(&wildversion) // will return true

```

And standard comparions can be used.

```rust

let vera = Version::fromstr("2.1.4"); let verb = Version::fromstr("2.2.3"); let verc = Version::fromstr("2.1.4");

vera < verb // true vera == verc // true

```

You can also get the latest available version from a list.

```rust let versions : Vec = vec![ Version::fromstr("1.0.0").unwrap(), Version::fromstr("1.0.1").unwrap(), Version::fromstr("1.1.0").unwrap(), Version::fromstr("1.0.2").unwrap() ];

let requirement = Version::from_str("1").unwrap();

let version = requirement.latestcompatibleversion(&versions); // would be Version (1.1.0)

```

Notes for Success

Pattern Matching

Currently the only wildcard supported is *. But ^ can be achieved by using short versions: 1.2 would match with 1.2.1 to 1.2.100 and would return the latest version in a list using ::latest_compatible_version.