| Crates.io | compare_version |
| lib.rs | compare_version |
| version | 1.2.3 |
| created_at | 2024-11-01 14:06:37.111996+00 |
| updated_at | 2025-08-02 06:57:37.320334+00 |
| description | A Rust library for comparing semantic versioning strings and checking version compatibility. |
| homepage | |
| repository | https://github.com/crates-dev/compare-version |
| max_upload_size | |
| id | 1431822 |
| size | 26,146 |
A Rust library for comparing semantic versioning strings and checking version compatibility.
^ and ~ notation.To use this crate, you can run cmd:
cargo add compare_version
use compare_version::*;
let result = CompareVersion::compare_version("1.2.3", "1.2.4");
assert_eq!(result, Ok(VersionComparison::Less));
let matches = CompareVersion::matches_version_range("1.2.3", "^1.2.0");
assert_eq!(matches, Ok(true));
let matches = CompareVersion::matches_version_range("1.2.3", "~1.2.4");
assert_eq!(matches, Ok(false));
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request.
For any inquiries, please reach out to the author at root@ltpp.vip.