pub fn save<P, T>(path: P, config: T, file_type: FileType) -> Result<()>Expand description
Save the current config to a TOML or JSON file.
The file_type must match the file extension inferred from path.
.jsonc paths are written as standard JSON and therefore require
FileType::JSON.
use cloudiful_config::{FileType, save};
use serde::Serialize;
#[derive(Serialize)]
struct AppConfig {
port: u16,
}
let path = std::env::temp_dir().join("config-crate-save-example.toml");
save(&path, AppConfig { port: 8080 }, FileType::TOML).unwrap();