27 lines
572 B
Rust
27 lines
572 B
Rust
use super::{download::Download, service::Service};
|
|
|
|
pub struct Downloader<'a> {
|
|
service: &'a Service,
|
|
files: Vec<String>,
|
|
}
|
|
|
|
impl<'a> Downloader<'a> {
|
|
pub fn new(service: &'a Service) -> Self {
|
|
Downloader {
|
|
service,
|
|
files: Vec::new(),
|
|
}
|
|
}
|
|
|
|
pub fn set_files(mut self, files: Vec<String>) -> Self {
|
|
self.files = files;
|
|
self
|
|
}
|
|
|
|
pub async fn download(&self) {
|
|
for file in self.files.clone() {
|
|
Download::new(self.service).set_obj_path(file).send().await;
|
|
}
|
|
}
|
|
}
|