cc_license

Crates.iocc_license
lib.rscc_license
version0.1.0
sourcesrc
created_at2023-03-28 18:15:47.214325
updated_at2023-03-28 18:15:47.214325
descriptionCreative Commons license parser
homepage
repositoryhttps://github.com/thoth-pub/cc-license
max_upload_size
id823301
size23,398
Javier Arias (ja573)

documentation

README

cc_license

A Rust library for parsing Creative Commons license URLs.

Build status Crates.io

Usage

To bring this crate into your repository, either add cc_license to your Cargo.toml, or run cargo add cc_license.

Here's an example parsing a CC license URL:

use cc_license::License;

fn main() {
    let license = License::from_url("https://creativecommons.org/licenses/by-nc-sa/4.0/")?;

    assert_eq!(license.to_string(), "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license (CC BY-NC-SA 4.0).".to_string());
    assert_eq!(license.rights(), "CC BY-NC-SA".to_string());
    assert_eq!(license.rights_full(), "Attribution-NonCommercial-ShareAlike".to_string());
    assert_eq!(license.version(), "4.0".to_string());
    assert_eq!(license.short(), "CC BY-NC 4.0".to_string());
}
Commit count: 12

cargo fmt