]> git.r.bdr.sh - rbdr/page/blame - src/file_handler/file_strategies/gemini.rs
Add basic strategies
[rbdr/page] / src / file_handler / file_strategies / gemini.rs
CommitLineData
102a4884
RBR
1pub struct Strategy {}
2
3use std::path::PathBuf;
4
5use crate::file_handler::{FileType, FileHandlerStrategy};
6
7impl FileHandlerStrategy for Strategy {
8 fn is(&self, path: &PathBuf) -> bool {
9 if let Some(extension) = path.extension() {
10 return !path.is_dir() && extension == "gmi"
11 }
12 false
13 }
14
15 fn identify(&self) -> FileType {
16 FileType::Gemini
17 }
18
19 fn can_handle(&self, path: &PathBuf) -> bool {
20 self.is(path)
21 }
22
23 fn handle(&self, path: &PathBuf) {
24 println!("Should convert {}", path.display())
25 }
26}