summaryrefslogtreecommitdiffstats
path: root/src/context/local_state.rs
blob: 049d90d196cfc52eaa633fea27e5011da1f51ba7 (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
27
28
29
use crate::io::FileOperation;

use std::iter::Iterator;
use std::path;

pub struct LocalStateContext {
    pub paths: Vec<path::PathBuf>,
    pub file_op: FileOperation,
}

impl LocalStateContext {
    pub fn new() -> Self {
        Self {
            paths: Vec::new(),
            file_op: FileOperation::Copy,
        }
    }

    pub fn set_file_op(&mut self, operation: FileOperation) {
        self.file_op = operation;
    }

    pub fn set_paths<I>(&mut self, vals: I)
    where
        I: Iterator<Item = path::PathBuf>,
    {
        self.paths = vals.collect();
    }
}