is_package_installed_or_provided

Function is_package_installed_or_provided 

Source
pub fn is_package_installed_or_provided<S: BuildHasher + Default>(
    name: &str,
    installed: &HashSet<String, S>,
    _provided: &HashSet<String, S>,
) -> bool
Expand description

What: Check if a package is installed or provided by an installed package.

Inputs:

  • name: Package name to check.
  • installed: Set of directly installed package names.
  • provided: Set of package names provided by installed packages (unused, kept for API compatibility).

Output:

  • Returns true if the package is directly installed or provided by an installed package.

Details:

  • First checks if the package is directly installed.
  • Then lazily checks if it’s provided by any installed package using pacman -Qqo.
  • This handles cases like rustup providing rust efficiently without querying all packages upfront.