fn download_collection(&mut self) {
        for collection in &self.grabber.posts {
            for post in &collection.posts {
                self.progress_bar
                    .set_message(&format!("Downloading: {} ", collection.name));
                let file_path: PathBuf = [
                    &self.download_directory,
                    &collection.category,
                    &self.remove_invalid_chars(&collection.name),
                    &self.remove_invalid_chars(&post.name),
                ]
                .iter()
                .collect();
                create_dir_all(file_path.parent().unwrap())
                    .with_context(|e| {
                        error!("Could not create directories for images!");
                        trace!("Directory path unable to be created...");
                        trace!(
                            "Path: \"{}\"",
                            file_path.parent().unwrap().to_str().unwrap()
                        );
                        format!("{}", e)
                    })
                    .unwrap();
                if file_path.exists() {
                    self.progress_bar
                        .set_message("Duplicate found: skipping... ");
                    self.progress_bar.inc(post.file_size as u64);
                    continue;
                }

                let bytes = self
                    .request_sender
                    .download_image(&post.url, post.file_size);
                self.save_image(file_path.to_str().unwrap(), &bytes);
                self.progress_bar.inc(post.file_size as u64);
            }
        }
    }
/// Processes `PostSet` and downloads all posts from it.
Processes `PostSet` and downloads all posts from it.
Processes ` PostSet ` and downloads all posts from it .
fn download_collection(&mut self) {
        for collection in &self.grabber.posts {
            for post in &collection.posts {
                self.progress_bar
                    .set_message(&format!("Downloading: {} ", collection.name));
                let file_path: PathBuf = [
                    &self.download_directory,
                    &collection.category,
                    &self.remove_invalid_chars(&collection.name),
                    &self.remove_invalid_chars(&post.name),
                ]
                .iter()
                .collect();
                create_dir_all(file_path.parent().unwrap())
                    .with_context(|e| {
                        error!("Could not create directories for images!");
                        trace!("Directory path unable to be created...");
                        trace!(
                            "Path: \"{}\"",
                            file_path.parent().unwrap().to_str().unwrap()
                        );
                        format!("{}", e)
                    })
                    .unwrap();
                if file_path.exists() {
                    self.progress_bar
                        .set_message("Duplicate found: skipping... ");
                    self.progress_bar.inc(post.file_size as u64);
                    continue;
                }
                let bytes = self
                    .request_sender
                    .download_image(&post.url, post.file_size);
                self.save_image(file_path.to_str().unwrap(), &bytes);
                self.progress_bar.inc(post.file_size as u64);
            }
        }
    }
fn download_collection ( & mut self ) { for collection in & self . grabber . posts { for post in & collection . posts { self . progress_bar . set_message ( & format ! ( " " collection name ) ) ; let file_path : PathBuf = [ & self . download_directory , & collection . category , & self . remove_invalid_chars ( & collection . name ) , & self . remove_invalid_chars ( & post . name ) , ] . iter ( ) . collect ( ) ; create_dir_all ( file_path . parent ( ) . unwrap ( ) ) . with_context ( | e | { error ! ( " " ) ; trace ! ( " " ) ; trace ! ( " \" \" " file_path parent ( ) unwrap ( ) to_str ( ) unwrap ( ) ) ; format ! ( " " e ) } ) . unwrap ( ) ; if file_path . exists ( ) { self . progress_bar . set_message ( " " ) ; self . progress_bar . inc ( post . file_size as u64 ) ; continue ; } let bytes = self . request_sender . download_image ( & post . url , post . file_size ) ; self . save_image ( file_path . to_str ( ) . unwrap ( ) , & bytes ) ; self . progress_bar . inc ( post . file_size as u64 ) ; } } }
Processes `PostSet` and downloads all posts from it.
Processes ` PostSet ` and downloads all posts from it .
&mut self
&mut self