Skip to main content

load_from_disk_async

Function load_from_disk_async 

Source
pub async fn load_from_disk_async(path: PathBuf) -> Result<OfficialIndex>
Expand description

What: Load an official package index from disk asynchronously.

Inputs:

  • path: File path to read the JSON index from.

Output:

  • Returns a future resolving to Result<OfficialIndex> (same semantics as load_from_disk).

Details:

  • Uses tokio::task::spawn_blocking to avoid blocking the async runtime on file I/O.

§Errors

Returns an error if the blocking task fails, the file cannot be read, or the JSON cannot be parsed.

§Example

use arch_toolkit::index::load_from_disk_async;
use std::path::PathBuf;

let index = load_from_disk_async(PathBuf::from("official_index.json")).await?;
println!("Loaded {} packages", index.pkgs.len());