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
use std::fmt::{Display, Formatter, Result as FmtResult};
use std::ops::Deref;
use std::path::PathBuf;

#[derive(Clone, Debug)]
pub struct TomlFile(PathBuf);

impl TomlFile {
    pub(crate) fn new(path: PathBuf) -> TomlFile {
        TomlFile(path)
    }
}

impl Deref for TomlFile {
    type Target = PathBuf;

    fn deref(&self) -> &Self::Target {
        &self.0
    }
}

impl Display for TomlFile {
    fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
        write!(f, "{}", self.to_str().unwrap())
    }
}