(&self)
| 167 | } |
| 168 | |
| 169 | pub fn read_config(&self) -> io::Result<Config> { |
| 170 | if self.config_path.exists() { |
| 171 | let mut file = OpenOptions::new().read(true).open(&self.config_path)?; |
| 172 | let mut content = String::new(); |
| 173 | file.read_to_string(&mut content)?; |
| 174 | Ok(toml::from_str(&content).unwrap_or_default()) |
| 175 | } else { |
| 176 | Ok(Config::default()) |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | pub fn write_config(&self, config: &Config) -> io::Result<()> { |
| 181 | let toml_string = toml::to_string(config).expect("Failed to serialize config"); |
no outgoing calls
no test coverage detected