Skip to main content

range

Function range 

Source
pub fn range(text: &str) -> Option<(VersionReq, bool)>
Expand description

The range text is, and whether it is one exact version: 1.4.2 is exactly that release, unlike Cargo’s requirements, where it would be ^1.4.2. None when it isn’t a range.

use compmd_pack::range;

assert_eq!(range("1.4.2").map(|(_, exact)| exact), Some(true));
assert_eq!(range("^1.4").map(|(_, exact)| exact), Some(false));
assert_eq!(range("latest!"), None);