pub async fn refresh_installed_cache_async(
cache: Option<&mut HashSet<String>>,
) -> Result<HashSet<String>>Expand description
What: Query pacman for all installed packages asynchronously and optionally update a cache.
Inputs:
cache: Optional mutable reference to aHashSet<String>to update with results.
Output:
- Returns a future that resolves to
Result<HashSet<String>>containing all installed package names.
Details:
- Uses
tokio::task::spawn_blockingto run the sync version in a blocking task. - If
cacheis provided, updates it with the results after the task completes. - The cache parameter must be
SendandSyncto be used across async boundaries.
§Errors
Returns Err if the blocking task fails, otherwise returns the same result as the sync version.
§Example
use arch_toolkit::index::refresh_installed_cache_async;
use std::collections::HashSet;
let mut cache = HashSet::new();
let packages = refresh_installed_cache_async(Some(&mut cache)).await?;
println!("Found {} installed packages", packages.len());