[][src]Module cpe::wfn

CPE Well-Formed Name

A CPE 2.3 WFN as defined in CPE-N:5.3

The values of a Wfn can be set directly via the fields, but this is discouraged, as there is no validation of the values. There are a few options for creating a Wfn:

  1. Parsing a WFN string
use cpe::wfn::Wfn;

let cpe: Wfn = Wfn::parse(r#"wfn:[part="a",vendor="rust",product="cargo"]"#).unwrap();
println!("{:?}", cpe);
  1. Using the builder pattern, with builder
  2. Using the "setter" methods
use cpe::wfn::Wfn;

let mut cpe: Wfn = Wfn::new();
cpe.set_part("a").unwrap();
cpe.set_vendor("rust").unwrap();
cpe.set_product("cargo").unwrap();

println!("{:?}", cpe);
  1. Using the wfn!{} macro
use cpe::{wfn, wfn::Wfn};

let cpe: Wfn = wfn!{
                  part: "a",
                  vendor: "rust",
                  product: "cargo",
              }.unwrap();

println!("{:?}", cpe);

Valid values

The valid values for WFN attributes come from the grammar for WFNs in [CPE-N:5.3.2]

Structs

OwnedWfn

Owned copy of a Wfn for when lifetimes do not permit borrowing from the input.

Wfn

A CPE 2.3 Well-Formed Name