Skip to content

license

SPDX license identifiers and expressions: look a license up, parse MIT OR Apache-2.0, check it against a policy, write a source header.

lookup gives the name and family (Category) of about forty common licenses, normalize updates the deprecated GNU identifiers, Expression parses and evaluates SPDX expressions, and header writes the copyright and SPDX-License-Identifier lines. This is information for tooling, not legal advice.

Cargo feature license (enabled by default). To compile only this module:

cargo add helpers4 --no-default-features --features license

or in Cargo.toml:

[dependencies]
helpers4 = { version = "0.0.6", default-features = false, features = ["license"] }

Import path: helpers4::license.

ItemWhat it does
CategoryHow a license treats the code that uses it: the main families, from most to least permissive.
ExpressionAn SPDX license expression: one license, or several combined with AND and OR.
headerThe two-line source header that carries a copyright notice and an SPDX license identifier.
LicenseInfoWhat is known about one license: its SPDX identifier, its name and its family.
lookupWhat this module knows about the license with SPDX identifier id.
normalizeThe current SPDX identifier for a deprecated one.

Documented on the page of the helper that returns them.

TypeReturned by
ParseExpressionErrorExpression