Expand description
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.
Structs§
- Index
Config - The configuration file of the index.
- Index
Dependency - A dependency of a package.
- Index
Package - An entry for a single version of a package in the index.
Enums§
- Dependency
Kind - Dependencies can come in three kinds
Functions§
- add
- Add a new entry to the index.
- add_
from_ crate - Add a new entry to the index.
- force_
add - Add a new entry to the index, overwriting the existing entry if one already exists.
- init
- Initialize a new registry index.
- list
- List entries in the index.
- list_
all - List all entries for all packages in the index.
- load_
config - Return the configuration file in an index.
- metadata
- Get the metadata for a package before publishing it.
- metadata_
from_ crate - Get the metadata for a package before publishing it.
- set_
yank - Set the
yank
value of a package in the index. - unyank
- Unyank a version in the index.
- validate
- Validate an index.
- yank
- Yank a version in the index.