]> git.r.bdr.sh - rbdr/page/blame_incremental - src/file_handler/file_strategies/gemini.rs
Add logic to read and assign files / layout
[rbdr/page] / src / file_handler / file_strategies / gemini.rs
... / ...
CommitLineData
1pub struct Strategy {}
2
3use std::path::PathBuf;
4
5use crate::file_handler::{File, 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, file_type: &FileType) -> bool {
20 match file_type {
21 FileType::Gemini => true,
22 _ => false,
23 }
24 }
25
26 fn handle(&self, file: &File) {
27 println!("Should parse and copy {}", file.path.display())
28 }
29}