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: DocumentCreationInformationpackage_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

Create new SPDX struct.

Get unique hashes for all files the SPDX.

Find related files of the package with the provided id.

Get all license identifiers from the SPDX.

Errors

Returns [SpdxError] if parsing of the expressions fails.

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

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.