pub async fn refresh_explicit_cache_async(
mode: InstalledPackagesMode,
cache: Option<&mut HashSet<String>>,
) -> Result<HashSet<String>>Expand description
What: Query pacman for explicitly installed packages asynchronously and optionally update a cache.
Inputs:
mode: Filter mode determining which packages to query (LeafOnlyorAllExplicit).cache: Optional mutable reference to aHashSet<String>to update with results.
Output:
- Returns a future that resolves to
Result<HashSet<String>>containing explicitly 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_explicit_cache_async, InstalledPackagesMode};
use std::collections::HashSet;
let mut cache = HashSet::new();
let packages = refresh_explicit_cache_async(InstalledPackagesMode::LeafOnly, Some(&mut cache)).await?;
println!("Found {} leaf packages", packages.len());