Load config from file, or return default if not found
()
| 97 | |
| 98 | /// Load config from file, or return default if not found |
| 99 | pub fn load() -> Self { |
| 100 | let Some(path) = Self::config_path() else { |
| 101 | return Self::default(); |
| 102 | }; |
| 103 | |
| 104 | match fs::read_to_string(&path) { |
| 105 | Ok(contents) => toml::from_str(&contents).unwrap_or_default(), |
| 106 | Err(_) => Self::default(), |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | /// Save config to file |
| 111 | pub fn save(&self) -> io::Result<()> { |
nothing calls this directly
no outgoing calls
no test coverage detected