X-Git-Url: https://git.r.bdr.sh/rbdr/page/blobdiff_plain/b03284133baa6339fe4adf48e4a6499ef3ac287b..f08e8d64dce087201089d2b3276b3dfcdb000173:/src/file_handler/mod.rs?ds=sidebyside diff --git a/src/file_handler/mod.rs b/src/file_handler/mod.rs index 522bcbf..e8a446b 100644 --- a/src/file_handler/mod.rs +++ b/src/file_handler/mod.rs @@ -8,7 +8,7 @@ use std::fs::read_to_string; use std::path::{Path, PathBuf}; pub struct FileHandler { - pub strategies: Vec>, + pub strategies: Vec>, pub layout: Option, } @@ -27,7 +27,7 @@ impl Default for FileHandler { impl FileHandler { pub fn identify(&self, path: &Path) -> FileType { - for strategy in self.strategies.iter() { + for strategy in &self.strategies { if strategy.is(path) { return strategy.identify(); } @@ -53,9 +53,9 @@ impl FileHandler { gemini_destination: &Path, files: &[File], ) { - files.iter().for_each(|file| { + for file in files { self.handle(source, html_destination, gemini_destination, file); - }); + } } pub fn handle( @@ -80,7 +80,7 @@ impl FileHandler { } } -pub trait FileHandlerStrategy { +pub trait Strategy { fn is(&self, path: &Path) -> bool; fn identify(&self) -> FileType; fn can_handle(&self, file_type: &FileType) -> bool; @@ -182,7 +182,7 @@ mod tests { file_type: FileType, } - impl FileHandlerStrategy for MockStrategy { + impl Strategy for MockStrategy { fn is(&self, _path: &Path) -> bool { self.is_match }