pub fn matches_version_range(
version: &str,
range: &str,
) -> Result<bool, VersionError>Expand description
Comparison functions
Checks whether a version matches a specified range, supporting ^ and ~ ranges.
§Arguments
version- A string slice that holds the version to check against the range.range- A string slice that holds the version range to check.
§Errors
Returns a VersionError if the version or range cannot be parsed.
§Examples
use compare_version::*;
let matches = matches_version_range("1.2.3", "^1.2.0");
assert_eq!(matches, Ok(true));use compare_version::*;
let matches = matches_version_range("1.2.3", "~1.2.4");
assert_eq!(matches, Ok(false));