]>
Commit | Line | Data |
---|---|---|
102a4884 RBR |
1 | pub struct Strategy {} |
2 | ||
3 | use std::path::PathBuf; | |
4 | ||
4fd89b80 | 5 | use crate::file_handler::{File, FileType, FileHandlerStrategy}; |
102a4884 RBR |
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 | ||
4fd89b80 RBR |
19 | fn can_handle(&self, file_type: &FileType) -> bool { |
20 | match file_type { | |
21 | FileType::Gemini => true, | |
22 | _ => false, | |
23 | } | |
102a4884 RBR |
24 | } |
25 | ||
ea529736 | 26 | fn handle(&self, source: &PathBuf, destination: &PathBuf, file: &File) { |
4fd89b80 | 27 | println!("Should parse and copy {}", file.path.display()) |
102a4884 RBR |
28 | } |
29 | } |