aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
blob: 78c3ffb9df1c04b27f7243d87fc038afcd841b3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use std::path::{Path, PathBuf};

pub use serde::{de::DeserializeOwned, Serialize};
pub use directories::ProjectDirs;
pub use toml;
pub use serde_json;
pub use serde_yaml;

#[derive(Debug)]
pub enum FondantError {
    InvalidHomeDir,
    ConfigParseError,
    DirCreateErr(std::io::Error),
    LoadError,
    FileWriteError,
    FileReadError,
    FileOpenError,
}

pub trait Config: Serialize + DeserializeOwned + Default {
    fn load() -> Result<Self, FondantError>;
    fn store(&self) -> Result<(), FondantError>;
}