Skip to main content

is_newer

Function is_newer 

Source
pub fn is_newer(latest: &str, current: &str) -> bool
Expand description

Whether latest is a strictly newer release than current. Unparsable versions compare as “not newer” — we never nag on garbage.

use coding_tools::update::is_newer;
assert!(is_newer("0.9.0", "0.8.4"));
assert!(is_newer("1.0.0", "1.0.0-rc.1")); // a release beats its pre-release
assert!(!is_newer("0.8.4", "0.8.4"));
assert!(!is_newer("0.8.3", "0.8.4"));
assert!(!is_newer("nonsense", "0.8.4"));