use std::path::PathBuf;
use serde::{Deserialize};
#[derive(Deserialize)]
pub struct ConfigFile {
pub dmenu: Option<PathBuf>,
pub font: Option<String>,
pub normal_bg: Option<String>,
pub normal_fg: Option<String>,
pub select_bg: Option<String>,
pub select_fg: Option<String>,
}
impl ConfigFile {
pub fn from<S>(s: S) -> Result<ConfigFile, String>
where
S: AsRef<[u8]>,
{
let s = s.as_ref();
let cfgfile = toml::from_slice(s)
.map_err(|e| format!("Error deserializing Dmx config: {}", &e))?;
Ok(cfgfile)
}
}