feat(config): add default and display implementation to RLMVO struct

This commit is contained in:
Federico Terzi 2021-08-10 20:15:32 +02:00
parent 52b73ba031
commit 8691e68e6b

View File

@ -196,7 +196,7 @@ pub enum ToggleKey {
LeftMeta, LeftMeta,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone, Default)]
pub struct RMLVOConfig { pub struct RMLVOConfig {
pub rules: Option<String>, pub rules: Option<String>,
pub model: Option<String>, pub model: Option<String>,
@ -205,6 +205,20 @@ pub struct RMLVOConfig {
pub options: Option<String>, pub options: Option<String>,
} }
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<NonFatalErrorSet>)> { pub fn load_store(config_dir: &Path) -> Result<(impl ConfigStore, Vec<NonFatalErrorSet>)> {
store::DefaultConfigStore::load(config_dir) store::DefaultConfigStore::load(config_dir)
} }