pub fn read_or_create_default<P, T>(path: P) -> Result<T, Error>Expand description
Read config from a TOML, JSON, or JSONC file, creating the file with
T::default() when it does not already exist.
use cloudiful_config::read_or_create_default;
use serde::{Deserialize, Serialize};
#[derive(Default, Deserialize, Serialize)]
struct AppConfig {
port: u16,
}
let path = std::env::temp_dir().join("config-crate-read-or-create.toml");
let _config: AppConfig = read_or_create_default(&path).unwrap();