mangofetch_core/core/
traits.rs1use crate::models::queue::QueueItemInfo;
2use std::sync::Arc;
3
4pub trait DownloadReporter: Send + Sync + 'static {
7 fn on_progress(&self, download_id: u64, progress: crate::core::events::QueueItemProgress);
9
10 fn on_complete(
12 &self,
13 download_id: u64,
14 file_path: Option<String>,
15 file_size_bytes: Option<u64>,
16 );
17
18 fn on_error(&self, download_id: u64, error_message: String);
20
21 fn on_retry(&self, download_id: u64, attempt: u32, delay_ms: u64);
23
24 fn on_phase_change(&self, download_id: u64, phase: String);
26
27 fn on_media_preview(
29 &self,
30 url: String,
31 title: String,
32 author: String,
33 thumbnail_url: Option<String>,
34 duration_seconds: Option<f64>,
35 );
36
37 fn on_queue_update(&self, state: Vec<QueueItemInfo>);
39
40 fn on_system_progress(&self, title: &str, percent: f32, message: &str);
42}
43
44pub type SharedReporter = Arc<dyn DownloadReporter>;