#packaging #index #dependencies #crate #meta

crates-index

Library for retrieving and interacting with the crates.io index

29 releases

new 0.19.3 Feb 1, 2023
0.18.12 Jan 23, 2023
0.18.11 Nov 4, 2022
0.18.8 May 23, 2022
0.1.2 May 27, 2015

#61 in Development tools

Download history 25641/week @ 2022-10-14 24763/week @ 2022-10-21 24419/week @ 2022-10-28 30525/week @ 2022-11-04 28604/week @ 2022-11-11 24695/week @ 2022-11-18 23245/week @ 2022-11-25 22642/week @ 2022-12-02 23545/week @ 2022-12-09 22673/week @ 2022-12-16 15064/week @ 2022-12-23 19887/week @ 2022-12-30 25534/week @ 2023-01-06 25443/week @ 2023-01-13 28159/week @ 2023-01-20 25272/week @ 2023-01-27

108,458 downloads per month
Used in 46 crates (30 directly)

Apache-2.0

55KB
1K SLoC

crates-index

crates-index on Crates.io

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

The index contains metadata for all Rust libraires and programs published on crates.io: their verisons, dependencies, and feature flags.

Documentation

Example

let index = crates_index::Index::new_cargo_default()?;

for crate_releases in index.crates() {
    let _ = crate_releases.most_recent_version(); // newest version
    let crate_version = crate_releases.highest_version(); // max version by semver
    println!("crate name: {}", crate_version.name());
    println!("crate version: {}", crate_version.version());
}

Migration from 0.18

It should work without any code changes. Only the git2 and toml dependencies were updated.

Migration from 0.16 and 0.17

  • BareIndex and BareIndexRepo have become the Index.
  • Index::new_cargo_default()? is the preferred way of accessing the index. Use with_path() to clone to a different directory.
  • There's no need to call retrieve() or exists(). It's always retrieved and always exists.
  • retrieve_or_update() is just update().
  • highest_version() returns crate metadata rather than just the version number. Call highest_version().version().parse() to get semver::Version.
  • There's no crate_index_paths(), because there are no files any more. Use crate_ to get individual crates.

Similar crates

License

Licensed under version 2 of the Apache License

Dependencies

~13MB
~331K SLoC