opensource

API Wrapper for the Open Source License API

3 unstable releases

Uses old Rust 2015

0.2.0 Dec 17, 2017
0.1.1 Jun 19, 2016
0.1.0 Jun 17, 2016

BSD-3-Clause

10KB
171 lines

rust-opensource

rust-opensource is an API Wrapper that allows you to query the Open Source License API with Rust.

Install

The crate is called opensource and you can depend on it via cargo:

[dependencies]
opensource = "0.2.0"

Documentation can be found at OpenSourceOrg.github.io/rust-opensource.

Examples

extern crate opensource;

use opensource::client;

fn main() {
    let license = client::get("BSD-3").unwrap();
    println!("{}", license.name);
}

A better way is to use match:

extern crate opensource;

use opensource::client;

fn main() {
    let license = client::get("this-license-does-not-exist");
    match license {
        Ok(license) => println!("{}", license.name),
        Err(err) => println!("{}", err),
    }
}

lib.rs:

opensource

opensource is an API Wrapper that allows you to query the Open Source License API with Rust.

Example

extern crate opensource;

use opensource::client;

fn main() {
    let license = client::get("BSD-3").unwrap();
    println!("{}", license.name);
}

A better way is to use match:

extern crate opensource;

use opensource::client;

fn main() {
    let license = client::get("this-license-does-not-exist");
    match license {
        Ok(license) => println!("{}", license.name),
        Err(err) => println!("{}", err),
    }
}

Dependencies

~15–24MB
~423K SLoC