Skip to main content

save

Function save 

Source
pub fn save<T>(app_name: &str, config: T) -> Result<()>
where T: Serialize,
Expand description

Save config to the platform-default config.toml for app_name.

On macOS, stock resolves to ~/Library/Application Support/stock/config.toml.

use cloudiful_config::save;
use serde::Serialize;

#[derive(Serialize)]
struct AppConfig {
    port: u16,
}

save("stock", AppConfig { port: 8080 }).unwrap();