Check if pre-release

    0

    1

    Giovanny Gongora

    Codiga's Rust Recipes

    works with semver format

    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(())
    }
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.