Skip to content

LicenseInfo

What is known about one license: its SPDX identifier, its name and its family.

Get it with lookup.

use helpers4::license::LicenseInfo;

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"] }
pub struct LicenseInfo { /* private fields */ }
use helpers4::license::{lookup, Category};

let info = lookup("apache-2.0").unwrap();
assert_eq!(info.id(), "Apache-2.0");
assert_eq!(info.name(), "Apache License 2.0");
assert_eq!(info.category(), Category::Permissive);
pub fn id(&self) -> &'static str

The SPDX identifier in its canonical case.

Returns

&'static str — For instance "Apache-2.0".

pub fn name(&self) -> &'static str

The full name of the license.

Returns

&'static str — For instance "Apache License 2.0".

pub fn category(&self) -> Category

The family the license belongs to.

Returns

Category — The Category.

src/license/license_info.rs