aboutsummaryrefslogtreecommitdiff
path: root/src/file_handler/file_strategies/file.rs
blob: b1de596f110e70060b89517f09a8969714b1d341 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
pub struct Strategy {}

use std::path::PathBuf;

use crate::file_handler::{File, FileType, FileHandlerStrategy};

impl FileHandlerStrategy for Strategy {
    fn is(&self, path: &PathBuf) -> bool {
        !path.is_dir()
    }

    fn identify(&self) -> FileType {
        FileType::File
    }

    fn can_handle(&self, file_type: &FileType) -> bool {
        match file_type {
            FileType::File => true,
            _ => false,
        }
    }

    fn handle(&self, file: &File) {
        println!("Should copy {}", file.path.display())
    }
}