cc_license 0.1.0

Creative Commons license parser
Documentation
  • Coverage
  • 50%
    6 out of 12 items documented5 out of 6 items with examples
  • Size
  • Source code size: 24.26 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.22 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 25s Average build duration of successful builds.
  • all releases: 25s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • thoth-pub/cc-license
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ja573

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