Skip to main content

parse_license_expression

Function parse_license_expression 

Source
pub fn parse_license_expression(license: &str) -> BTreeSet<String>
Expand description

Extracts individual license IDs from an SPDX expression.

Parses the expression and returns all license IDs found. If parsing fails, returns the original string as a single-element set.

ยงExample

use sbom_model::parse_license_expression;

let ids = parse_license_expression("MIT OR Apache-2.0");
assert!(ids.contains("MIT"));
assert!(ids.contains("Apache-2.0"));