Struct spdx_rs::models::SPDX [−][src]
pub struct SPDX {
pub document_creation_information: DocumentCreationInformation,
pub package_information: Vec<PackageInformation>,
pub other_licensing_information_detected: Vec<OtherLicensingInformationDetected>,
pub file_information: Vec<FileInformation>,
pub snippet_information: Vec<Snippet>,
pub relationships: Vec<Relationship>,
pub annotations: Vec<Annotation>,
pub spdx_ref_counter: i32,
}
Expand description
A representation of an SPDX Document
This is the main struct of this crate. The struct implements Serialize
and Deserialize
to allow it to be serialized into and deserialized from any data format supported by Serde.
SPDX specification version
The crate has been developed around SPDX version 2.2.1. Fields deprecated in 2.2.1, like review information are not supported. The plan is to support newer versions as they are released.
Data formats
The crate has been developed for usage with JSON SPDX documents. The naming of the fields should conform to the spec for at least JSON. Other formats, like YAML may work, but no guarantees are made.
The crate also allows for deserializing the struct from SPDX documents in tag-value format
with crate::parsers::spdx_from_tag_value
.
Fields
document_creation_information: DocumentCreationInformation
package_information: Vec<PackageInformation>
other_licensing_information_detected: Vec<OtherLicensingInformationDetected>
file_information: Vec<FileInformation>
snippet_information: Vec<Snippet>
relationships: Vec<Relationship>
annotations: Vec<Annotation>
spdx_ref_counter: i32
Counter for creating SPDXRefs. Is not part of the spec, so don’t serialize.
Implementations
Get unique hashes for all files the SPDX.
pub fn get_files_for_package(
&self,
package_spdx_id: &str
) -> Vec<(&FileInformation, &Relationship)>
pub fn get_files_for_package(
&self,
package_spdx_id: &str
) -> Vec<(&FileInformation, &Relationship)>
Find related files of the package with the provided id.
Get all relationships where the given SPDX ID is the SPDX element id.
Get all relationships where the given SPDX ID is the related SPDX element id.
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more