arcbox_asset/progress.rs
1//! Progress reporting types for asset downloads.
2
3/// Progress information for a single asset being prepared.
4#[derive(Debug, Clone)]
5pub struct PrepareProgress {
6 /// Name of the asset currently being processed.
7 pub name: String,
8 /// 1-based index of the current asset.
9 pub current: usize,
10 /// Total number of assets.
11 pub total: usize,
12 /// Current phase.
13 pub phase: PreparePhase,
14}
15
16/// Phase within a single asset's lifecycle.
17#[derive(Debug, Clone)]
18pub enum PreparePhase {
19 /// Checking whether the asset is already cached and valid.
20 Checking,
21 /// Downloading the asset.
22 Downloading { downloaded: u64, total: Option<u64> },
23 /// Verifying checksum after download.
24 Verifying,
25 /// Asset is ready (freshly downloaded and verified).
26 Ready,
27 /// Asset was already cached with a valid checksum.
28 Cached,
29}
30
31/// Boxed progress callback.
32pub type ProgressCallback = Box<dyn Fn(PrepareProgress) + Send + Sync>;