#creative #parser #cc #common #url

cc_license

Creative Commons license parser

1 unstable release

0.1.0 Mar 28, 2023

#4 in #commons

Download history 32/week @ 2023-12-18 21/week @ 2024-01-08 34/week @ 2024-01-15 11/week @ 2024-02-05 70/week @ 2024-02-12 99/week @ 2024-02-19 118/week @ 2024-02-26 77/week @ 2024-03-04 35/week @ 2024-03-11 49/week @ 2024-03-25 22/week @ 2024-04-01

109 downloads per month

MIT license

21KB
482 lines

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());
}

Dependencies

~2.1–3MB
~53K SLoC