Expand description
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));
Macros§
- const_
version - Allows compile time generation of Versions from string literals.
Structs§
- Version
- Version in a SemVer like way.
- Version
Req - Representing an actual version requirenment, normally constructed through VersionReq::new.
Enums§
- Version
ReqVariant - The variants in which a version requirenment can be constructed.
- Version
ReqVariant Lower Bound - Lower bound part of VersionReqVariant::Compound
- Version
ReqVariant Upper Bound - Lower bound part of VersionReqVariant::Compound