[![semver-badge]][semver] [![cat-config-badge]][cat-config]
给出两个版本,is_prerelease
断言一个是预发布,另一个不是。
extern crate semver;
use semver::{Version, SemVerError};
fn main() -> Result<(), SemVerError> {
let version_1 = Version::parse("1.0.0-alpha")?;
let version_2 = Version::parse("1.0.0")?;
assert!(version_1.is_prerelease());
assert!(!version_2.is_prerelease());
Ok(())
}