Function cargo_update::ops::installed_main_repo_packages [] [src]

pub fn installed_main_repo_packages(crates_file: &Path) -> Vec<MainRepoPackage>

List the installed packages at the specified location that originate from the main crates.io 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_main_repo_packages(&cargo_dir);
for package in &packages {
    println!("{} v{}", package.name, package.version.as_ref().unwrap());
}