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.
let index = crates_index::Index::new_cargo_default()?;
for crate_releases in index.crates() {
let _ = crate_releases.most_recent_release(); // 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());
}
BareIndex
andBareIndexRepo
have become theIndex
.Index::new_cargo_default()?
is the preferred way of accessing the index. Usewith_path()
to clone to a different directory.- There's no need to call
retrieve()
orexists()
. It's always retrieved and always exists. retrieve_or_update()
is justupdate()
.highest_version()
returns crate metadata rather than just the version number. Callhighest_version().version().parse()
to getsemver::Version
.- There's no
crate_index_paths()
, because there are no files any more. Usecrate_
to get individual crates.
Licensed under version 2 of the Apache License