use serde::Deserialize; use std::collections::HashMap; use thiserror::Error as TeError; use toml; #[derive(Debug, TeError)] #[error("{0}")] pub enum Error { Io(#[from] std::io::Error), Toml(#[from] toml::de::Error), } pub type Result = std::result::Result; #[derive(Debug, Deserialize)] pub struct Manifest { pub(crate) identifier: String, pub(crate) path: String, pub(crate) clsid: String, pub(crate) manners: HashMap, pub(crate) exts: HashMap, } impl Manifest { pub fn from_file(path: &str) -> Result { let contents = std::fs::read_to_string(path)?; let config: Manifest = toml::from_str(&contents)?; Ok(config) } }