use std::path::{Path, PathBuf}; use sha1_smol::Digest; pub trait Download { fn get_url(&self) -> &str; fn get_path(&self) -> &Path; fn get_expect_digest(&self) -> Option; fn get_expect_size(&self) -> Option; fn always_redownload(&self) -> bool; } pub type DownloadJob = dyn Download + Sync + Send; pub struct MultiDownloader<'j, 'js> { jobs: &'js [&'j DownloadJob], nhandles: usize } impl<'j, 'js> MultiDownloader<'j, 'js> { pub fn new(jobs: &'js [&'j DownloadJob]) -> MultiDownloader<'j, 'js> { Self::with_handles(jobs, 8) } pub fn with_handles(jobs: &'js [&'j DownloadJob], nhandles: usize) -> MultiDownloader<'j, 'js> { assert!(nhandles > 0); MultiDownloader { jobs, nhandles } } fn do_it(&self) { } }