[go: up one dir, main page]

Crate license

source ·
Expand description

Provides embedded license information from SPDX.

Use the licenses directly.

use license::License;
use license::licenses::Bsd3Clause;

let bsd3 = Bsd3Clause;
assert!(bsd3.is_osi_approved());
assert_eq!(bsd3.name(), r#"BSD 3-Clause "New" or "Revised" License"#);

Get the license by parsing the license id.

use license::License;

let apache2: &dyn License = "Apache-2.0".parse().unwrap();
assert_eq!(apache2.name(), "Apache License 2.0");

License exceptions are also supported.

use license::Exception;

let gcc: &dyn Exception = "GCC-exception-3.1".parse().unwrap();
assert_eq!(gcc.name(), "GCC Runtime Library exception 3.1");

By default, this library downloads the latest licenses from github.com/spdx. If you want to build it offline instead, you can enable the offline feature.

Modules

Structs

  • Error returned when parsing license and exception ids.

Traits

  • Base functionality for all license exceptions.
  • Base functionality for all licenses.