From 379365322562eaf9ed37bc54e24d0ace3a23a974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Qui=C3=B1ones?= Date: Sun, 28 Jan 2024 13:32:13 -0500 Subject: [PATCH] feat(config): implementing `Default` trait --- src/config.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index 480001d..a89394b 100644 --- a/src/config.rs +++ b/src/config.rs @@ -48,7 +48,7 @@ pub struct Config { pub interval_ms: u64, } -impl Config { +impl Default for Config { fn default() -> Self { let default_body = "Charge: ${{capacity}}%"; @@ -75,7 +75,9 @@ impl Config { }, } } +} +impl Config { pub fn parse(config_path: String) -> Result> { let content = fs::read_to_string(config_path)?; let config: Config = toml::from_str(&content)?;