Function cargo_update::ops::installed_registry_packages[][src]

pub fn installed_registry_packages(crates_file: &Path) -> Vec<RegistryPackage>
Expand description

List the installed packages at the specified location that originate from the a cargo registry.

If the .crates.toml file doesn’t exist an empty vector is returned.

This also deduplicates packages and assumes the latest version as the correct one to work around #44 a.k.a. rust-lang/cargo#4321.

Examples

let packages = installed_registry_packages(&cargo_dir);
for package in &packages {
    println!("{} v{}", package.name, package.version.as_ref().unwrap());
}