From 14196be5c52d9b575d0e28c45e8c8617e59b336a Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Tue, 23 Mar 2021 22:03:25 +0100 Subject: [PATCH] fix(config): improve signature of config loader --- espanso-config/src/lib.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/espanso-config/src/lib.rs b/espanso-config/src/lib.rs index e049134..796221b 100644 --- a/espanso-config/src/lib.rs +++ b/espanso-config/src/lib.rs @@ -32,7 +32,7 @@ mod legacy; pub mod matches; mod util; -pub fn load(base_path: &Path) -> Result<(impl ConfigStore, impl MatchStore)> { +pub fn load(base_path: &Path) -> Result<(Box, Box)> { let config_dir = base_path.join("config"); if !config_dir.exists() || !config_dir.is_dir() { return Err(ConfigError::MissingConfigDir().into()); @@ -43,7 +43,11 @@ pub fn load(base_path: &Path) -> Result<(impl ConfigStore, impl MatchStore)> { let match_store = matches::store::new(&root_paths.into_iter().collect::>()); - Ok((config_store, match_store)) + Ok((Box::new(config_store), Box::new(match_store))) +} + +pub fn load_legacy(config_dir: &Path, package_dir: &Path) -> Result<(Box, Box)> { + legacy::load(config_dir, package_dir) } pub fn is_legacy_config(base_dir: &Path) -> bool { @@ -60,7 +64,7 @@ pub enum ConfigError { mod tests { use super::*; use crate::util::tests::use_test_directory; - use config::{AppProperties, ConfigStore}; + use config::{AppProperties}; #[test] fn load_works_correctly() {