pub fn format_range(min: Option<&str>, max: Option<&str>) -> Option<String>Expand description
Format an optional (min, max) nginx version pair as a human-readable
range. Returns None when both bounds are unset.
Uses >= / <= comparison-operator notation rather than Rust’s ..=
inclusive-range syntax — most nginx-lint users are not Rust developers
and >=/<= is the same notation npm, pip, and similar tools use for
version constraints.
§Examples
use nginx_lint_common::nginx_version::format_range;
assert_eq!(
format_range(Some("0.6.27"), Some("1.30.0")),
Some("nginx >=0.6.27, <=1.30.0".to_string())
);
assert_eq!(format_range(Some("1.0.0"), None), Some("nginx >=1.0.0".to_string()));
assert_eq!(format_range(None, Some("1.30.0")), Some("nginx <=1.30.0".to_string()));
assert_eq!(format_range(None, None), None);