(&self, path: &Path)
| 195 | } |
| 196 | |
| 197 | pub fn save(&self, path: &Path) -> Result<(), std::io::Error> { |
| 198 | let data = serde_json::to_string_pretty(self) |
| 199 | .map_err(|e| std::io::Error::new(std::io::ErrorKind::InvalidData, e))?; |
| 200 | let tmp = path.with_extension("tmp"); |
| 201 | fs::write(&tmp, &data)?; |
| 202 | fs::rename(&tmp, path) |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | /// Enumerate every PCI device on the host that is structurally eligible |
no outgoing calls