8 releases (5 breaking)

✓ Uses Rust 2018 edition

0.5.1 Aug 23, 2019
0.5.0 Jun 22, 2019
0.4.1 Apr 9, 2019
0.4.0 Mar 1, 2019
0.0.2 May 14, 2017

#41 in HTTP client

Download history 52/week @ 2019-08-11 117/week @ 2019-08-18 278/week @ 2019-08-25 115/week @ 2019-09-01 73/week @ 2019-09-08 240/week @ 2019-09-15 196/week @ 2019-09-22 76/week @ 2019-09-29 178/week @ 2019-10-06 44/week @ 2019-10-13 51/week @ 2019-10-20 42/week @ 2019-10-27 50/week @ 2019-11-03 32/week @ 2019-11-10 117/week @ 2019-11-17

345 downloads per month
Used in 3 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

~16MB
~400K SLoC