Expand description
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
:
- Parsing a WFN string
use cpe::wfn::Wfn;
let cpe: Wfn = Wfn::parse(r#"wfn:[part="a",vendor="rust",product="cargo"]"#).unwrap();
println!("{:?}", cpe);
- Using the builder pattern, with builder
- 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);
- 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
- Owned copy of a Wfn for when lifetimes do not permit borrowing from the input.
- A CPE 2.3 Well-Formed Name