Function spdx_rs::parsers::spdx_from_tag_value
source · pub fn spdx_from_tag_value(input: &str) -> Result<SPDX, SpdxError>
Expand description
Parse a tag-value SPDX document to SPDX
.
Usage
use spdx_rs::parsers::spdx_from_tag_value;
let spdx_file = std::fs::read_to_string("tests/data/SPDXTagExample-v2.2.spdx")?;
let spdx_document = spdx_from_tag_value(&spdx_file)?;
assert_eq!(
spdx_document.document_creation_information.document_name,
"SPDX-Tools-v2.0"
);
Errors
- If parsing of the tag-value fails.
- If parsing of some of the values fail.