Skip to main content

get_installed_packages

Function get_installed_packages 

Source
pub fn get_installed_packages() -> Result<HashSet<String>>
Expand description

What: Query pacman directly for all installed packages without caching.

Inputs:

  • None: Invokes pacman -Qq to query the local database.

Output:

  • Returns Ok(HashSet<String>) containing all installed package names.
  • Returns Ok(HashSet::new()) on failure (graceful degradation).

Details:

  • Direct query to pacman, no caching involved.
  • Reuses the same logic as refresh_installed_cache but without cache parameter.
  • Sets LC_ALL=C and LANG=C for consistent locale-independent output.

§Errors

This function does not return errors - it gracefully degrades by returning an empty set. Errors are logged using tracing::error for diagnostics.

§Example

use arch_toolkit::index::get_installed_packages;

let packages = get_installed_packages().unwrap();
println!("Found {} installed packages", packages.len());