7 releases (breaking)

✓ Uses Rust 2018 edition

0.5.0 Jun 22, 2019
0.4.1 Apr 9, 2019
0.4.0 Mar 1, 2019
0.3.0 Oct 9, 2018
0.0.2 May 14, 2017

#43 in HTTP client

Download history 276/week @ 2019-04-10 97/week @ 2019-04-17 384/week @ 2019-04-24 77/week @ 2019-05-01 52/week @ 2019-05-08 56/week @ 2019-05-15 29/week @ 2019-05-22 26/week @ 2019-05-29 11/week @ 2019-06-05 96/week @ 2019-06-12 116/week @ 2019-06-19 176/week @ 2019-06-26 312/week @ 2019-07-03 64/week @ 2019-07-10 19/week @ 2019-07-17

440 downloads per month
Used in 2 crates

MIT/Apache

34KB
768 lines

crates_io_api

A Rust client for the crates.io API.

This crate aims to provide an easy to use and complete client for retrieving detailed information about Rust's crate ecosystem.

Both a synchronous and a Tokio/futures based async client are provided.

How to use

For usage information and examples, check out the Documentation.


lib.rs:

API client for crates.io.

It aims to provide an easy to use and complete client for retrieving information about Rust's crate ecosystem.

Note: Right now, only a synchronous client is available. Once the Async version of hyper stabilizes, an asynchronous client based on Tokio will be added.

Examples

Print the most downloaded crates and their non-optional dependencies:

use crates_io_api::{SyncClient, Error};

fn list_top_dependencies() -> Result<(), Error> {
    // Instantiate the client.
    let client = SyncClient::new();
    // Retrieve summary data.
    let summary = client.summary()?;
    for c in summary.most_downloaded {
        println!("{}:", c.id);
        for dep in client.crate_dependencies(&c.id, &c.max_version)? {
            // Ignore optional dependencies.
            if !dep.optional {
                println!("    * {} - {}", dep.id, dep.version_id);
            }
        }
    }
    Ok(())
}

Dependencies

~17MB
~399K SLoC