]> git.r.bdr.sh - rbdr/page/blob - src/file_handler/file_strategies/gemini.rs
Add basic strategies
[rbdr/page] / src / file_handler / file_strategies / gemini.rs
1 pub struct Strategy {}
2
3 use std::path::PathBuf;
4
5 use crate::file_handler::{FileType, FileHandlerStrategy};
6
7 impl 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 }