write_toml_file

Function write_toml_file 

Source
pub fn write_toml_file<T>(path: &Path, data: &T) -> Result<()>
where T: Serialize,
Expand description

Writes data as TOML to a file atomically.

§Arguments

  • path - The path to write to
  • data - The data to serialize
  • pretty - Whether to use pretty formatting (always true for TOML)

§Type Parameters

  • T - The type to serialize (must implement Serialize)

§Returns

Ok(()) on success

§Errors

Returns an error if serialization fails or the file cannot be written