use serde::{Deserialize, Serialize};
-use serde_json;
+use serde_json::{from_str, to_string};
use std::env;
use std::fs::{create_dir_all, write, File};
use std::io::{Read, Result};
let mut config_file = File::open(&config_file_path).ok()?;
let mut config_contents = String::new();
config_file.read_to_string(&mut config_contents).ok()?;
- serde_json::from_str(&config_contents).ok()?
+ from_str(&config_contents).ok()?
}
fn write(configuration: &Configuration) -> Result<()> {
let config_file_path = Configuration::file_path();
- if let Ok(serialized_configuration) = serde_json::to_string(&configuration) {
+ if let Ok(serialized_configuration) = to_string(&configuration) {
write(&config_file_path, serialized_configuration)?;
}
Ok(())