use std::path::Path; use thiserror::Error; use serde::de::DeserializeOwned; #[derive(Debug, Error)] pub enum ConfigLoadingError{ #[error(transparent)] IoError(#[from] std::io::Error), #[error(transparent)] ParseError(#[from] toml::de::Error), } pub fn config_from_file(filepath: impl AsRef) -> Result { let toml_string: String = std::fs::read_to_string(filepath)?; Ok(toml::from_str(&toml_string)?) }