2017-10-19 14:04:58 +00:00
|
|
|
use toml;
|
|
|
|
|
|
|
|
use settings::SettingsLoader;
|
|
|
|
|
|
|
|
pub struct Store {}
|
2017-10-18 14:49:56 +00:00
|
|
|
|
|
|
|
impl Store {
|
|
|
|
pub fn new() -> Self {
|
2017-10-19 14:04:58 +00:00
|
|
|
Store {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
struct Settings {
|
|
|
|
plugs: Vec<PlugInfo>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl SettingsLoader for Settings {
|
|
|
|
const SETTINGS_FILE: &'static str = "plugs.toml";
|
|
|
|
|
|
|
|
fn empty() -> Self {
|
|
|
|
Settings { plugs: vec![] }
|
|
|
|
}
|
|
|
|
|
|
|
|
fn from_str(s: &str) -> Result<Self, String> {
|
|
|
|
toml::from_str(&s).map_err(|e| format!("{}", e))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
pub struct PlugInfo {
|
|
|
|
name: String,
|
|
|
|
url: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl PlugInfo {
|
|
|
|
pub fn new(name: String, url: String) -> Self {
|
|
|
|
PlugInfo { name, url }
|
2017-10-18 14:49:56 +00:00
|
|
|
}
|
|
|
|
}
|