From 8691e68e6b95cbee157a6391f6c5d421bce7cca8 Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Tue, 10 Aug 2021 20:15:32 +0200 Subject: [PATCH] feat(config): add default and display implementation to RLMVO struct --- espanso-config/src/config/mod.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/espanso-config/src/config/mod.rs b/espanso-config/src/config/mod.rs index c8c0208..5e0e16a 100644 --- a/espanso-config/src/config/mod.rs +++ b/espanso-config/src/config/mod.rs @@ -196,7 +196,7 @@ pub enum ToggleKey { LeftMeta, } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Default)] pub struct RMLVOConfig { pub rules: Option, pub model: Option, @@ -205,6 +205,20 @@ pub struct RMLVOConfig { pub options: Option, } +impl std::fmt::Display for RMLVOConfig { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + write!( + f, + "[R={}, M={}, L={}, V={}, O={}]", + self.rules.as_deref().unwrap_or_default(), + self.model.as_deref().unwrap_or_default(), + self.layout.as_deref().unwrap_or_default(), + self.variant.as_deref().unwrap_or_default(), + self.options.as_deref().unwrap_or_default(), + ) + } +} + pub fn load_store(config_dir: &Path) -> Result<(impl ConfigStore, Vec)> { store::DefaultConfigStore::load(config_dir) }