cve-id 0.2.2

Typesafe Common Vulnerabilities and Exposures (CVE) Identifier
docs.rs failed to build cve-id-0.2.2
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: cve-id-0.2.3

Typesafe Common Vulnerabilities and Exposures (CVE) Identifier

use cve_id::{CveId, CveYear};

fn cveid_example() -> Result<(), Box<dyn std::error::Error>> {
    let cve_id = CveId::from_str("CVE-1999-0001")?;

    assert_eq!(cve_id.year(), 1999);
    assert_eq!(cve_id.number(), 1);
    assert_eq!(cve_id.to_string(), "CVE-1999-0001");

    const CVE_TEST_YEAR: CveYear = {
        let Ok(year) = CveYear::new(1900) else {
            panic!("not a valid CVE year")
        };
        year
    };
    const CVE_TEST_ID: CveId = CveId::new(CVE_TEST_YEAR, 42);
    assert!(CVE_TEST_ID.is_example_or_test());

    Ok(())
}