Crate crates_index

source ·
Expand description

Library for retrieving and interacting with the crates.io git index.

Examples

Getting information about a single crate

let index = crates_index::Index::new_cargo_default()?;
let serde_crate = index.crate_("serde").expect("you should handle errors here");
println!("Serde is at v{}", serde_crate.highest_normal_version().unwrap().version());

Iterating over all crates in the index

let index = crates_index::Index::new_cargo_default()?;
for crate_ in index.crates() {
   let latest = crate_.most_recent_version();
   println!("crate name: {}", latest.name());
   println!("most recently released version: {}", latest.version());
}

// or faster:
use rayon::prelude::*;
index.crates_parallel().for_each(|crate_| {
    /* etc. */
});

Re-exports

Modules

  • Re-exports in case you want to inspect specific error details

Structs

  • A whole crate with all its versions
  • Iterator over all crates in the index. Skips crates that failed to parse.
  • A single dependency of a specific crate version
  • Wrapper around managing the crates.io-index git repository
  • Global configuration of an index, reflecting the contents of config.json.
  • Wrapper around managing a sparse HTTP index, re-using Cargo’s local disk caches.
  • A single version of a crate (package) published to the index

Enums

Constants