[][src]Crate crates_io_api

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

Structs

AsyncClient

Asynchronous client for the crates.io API.

Authors
AuthorsMeta
AuthorsResponse
Category
Crate
CrateLinks
CrateResponse
CratesResponse
Dependencies
Dependency
Downloads
DownloadsMeta
ExtraDownloads
FullCrate
FullVersion
Keyword
ListOptions

Options for the crates method of the client.

Meta

Pagination information.

Owners
ReverseDependencies
ReverseDependency
Summary
SyncClient

A synchronous client for the crates.io API.

User
Version
VersionDownloads
VersionLinks

Enums

Error
Sort

Used to specify the sort behaviour of the Client::crates() method.