10 releases (5 breaking)

0.6.0 Oct 23, 2023
0.5.0 Jul 12, 2022
0.4.1 Jan 19, 2022
0.4.0 Apr 6, 2021
0.1.0 Dec 24, 2018

#685 in Cargo plugins

Download history 10/week @ 2024-07-15 16/week @ 2024-07-22 10/week @ 2024-07-29 5/week @ 2024-08-05 2/week @ 2024-08-12 29/week @ 2024-08-19 18/week @ 2024-08-26 12/week @ 2024-09-02 35/week @ 2024-09-09 11/week @ 2024-09-16 77/week @ 2024-09-23 47/week @ 2024-09-30 30/week @ 2024-10-07 5/week @ 2024-10-14 18/week @ 2024-10-21 15/week @ 2024-10-28

68 downloads per month
Used in cargo-index

MIT/Apache

57KB
951 lines

Cargo registry index library.

crates.io docs

An experimental library for managing a Cargo registry index. See cargo-index for the CLI command that uses this library.


lib.rs:

This library is for accessing and manipulating a Cargo registry index.

A very basic example:

// Initialize a new index.
reg_index::init(&index_path, "https://example.com", None)?;
// Add a package to the index.
reg_index::add(&index_path, index_url, Some(&manifest_path), None, None)?;
// Packages can be yanked.
reg_index::yank(&index_path, "foo", "0.1.0")?;
// Get the metadata for the new entry.
let pkgs = reg_index::list(&index_path, "foo", None)?;
// Displays something like:
// {"name":"foo","vers":"0.1.0","deps":[],"features":{},"cksum":"d87f097fcc13ae97736a7d8086fb70a0499f3512f0fe1fe82e6422f25f567c83","yanked":true,"links":null}
println!("{}", serde_json::to_string(&pkgs[0])?);

See https://doc.rust-lang.org/cargo/reference/registries.html for documentation about Cargo registries.

Locking

The functions here perform simple filesystem locking to ensure multiple commands running at the same time do not interfere with one another. This requires that the filesystem supports locking.

Dependencies

~13–23MB
~404K SLoC