1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
use serde::{Deserialize, Serialize};
use std::path::PathBuf;

/// Specifies a path to a configuration file and its type
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub enum ConfigPath {
    /// Path to the global configuration file
    Global(PathBuf),
    /// Path to a local configuration file
    Local(PathBuf),
}

impl ConfigPath {
    pub fn get_path(&self) -> &PathBuf {
        match self {
            ConfigPath::Global(p) | ConfigPath::Local(p) => p,
        }
    }
}