fast-version

Crates.iofast-version
lib.rsfast-version
version0.2.1
sourcesrc
created_at2022-04-29 17:32:05.271886
updated_at2022-05-01 09:42:38.451268
descriptionFast version requirenments and matching
homepage
repository
max_upload_size
id577446
size5,900
Hannes (umgefahren)

documentation

README

fast-version

license
shield crates.io
shield

Utility crate for fast SemVer like Versions and Version Requirenments. If you look for full SemVer experience and/or easy usage, please consider the excellent semver crate.

This implementation however doesn't require allocations, thus can be used in compile time evaluation. (support for embedded will follow)

Example

use fast_version::{Version, VersionReq, VersionReqVariant, const_version};

const VERSION: Version = const_version!("1.2.3");

assert_eq!(VERSION.major, 1);
assert_eq!(VERSION.minor, 2);
assert_eq!(VERSION.patch, 3);

const VERSION_REQ_MATCH: VersionReq = {
    let version_req_variant = VersionReqVariant::Strict(VERSION);
    VersionReq::new(&version_req_variant)
};

assert!(VERSION_REQ_MATCH.matches(&VERSION));

const VERSION_REQ_UNMATCH: VersionReq = {
    let version_req_variant = VersionReqVariant::MajorLessEqual { major: 0 };
    VersionReq::new(&version_req_variant)
};

assert!(!VERSION_REQ_UNMATCH.matches(&VERSION));

License: MIT

Commit count: 0

cargo fmt