Skip to content

Commit

Permalink
feat(config): implementing Default trait
Browse files Browse the repository at this point in the history
  • Loading branch information
luisnquin committed Jan 28, 2024
1 parent c306092 commit 3793653
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}}%";

Expand All @@ -75,7 +75,9 @@ impl Config {
},
}
}
}

impl Config {
pub fn parse(config_path: String) -> Result<Self, Box<dyn std::error::Error>> {
let content = fs::read_to_string(config_path)?;
let config: Config = toml::from_str(&content)?;
Expand Down

0 comments on commit 3793653

Please sign in to comment.