[][src]Function cargo_update::ops::get_index_path

pub fn get_index_path(
    cargo_dir: &Path,
    registry_url: Option<&str>
) -> Result<PathBuf, &'static str>

Get the location of the latest registry index whose name optionally starts with the registry URL's domain name in the specified cargo directory.

If no indices exist, an appropriate Err is returned.

Examples

// These are equivalent for most users,
// but you might need to specify the URL to find the right checkout if you use more than one registry
let index = get_index_path(&cargo_dir, None).unwrap();
let index = get_index_path(&cargo_dir, Some("https://github.com/rust-lang/crates.io-index")).unwrap();

// Use find_package_data() to look for packages