Crate spdx

source · []


pub use error::ParseError;
pub use expression::Expression;
pub use lexer::ParseMode;


Error types

Auto-generated lists of license identifiers and exception identifiers

Contains types for lexing an SPDX license expression


Unique identifier for a particular exception

Unique identifier for a particular license

Represents a single license requirement, which must include a valid LicenseItem, and may allow current and future versions of the license, and may also allow for a specific exception

A convenience wrapper for a license and optional exception that can be checked against a license requirement to see if it satisfies the requirement placed by a license holder


A single license term in a license expression, according to the SPDX spec. This can be either an SPDX license, which is mapped to a LicenseId from a valid SPDX short identifier, or else a document AND/OR license ref


Attempts to find an ExceptionId for the string

Find license partially matching the name, e.g. “apache” => “Apache-2.0” Returns length (in bytes) of the string matched. Garbage at the end is ignored. See identifiers::IMPRECISE_NAMES for the list of invalid names, and the valid license identifiers they are paired with.

Attempts to find a LicenseId for the string. Note that any + at the end is trimmed when searching for a match.

Returns the version number of the SPDX list from which the license and exception identifiers are sourced from