Skip to main content

write_file

Function write_file 

Source
pub fn write_file(
    path: &Path,
    content: &str,
    temp_suffix: Option<&str>,
) -> Result<()>
Expand description

Write file content atomically using a temp file + rename. If temp_suffix is provided, uses path.<suffix> as the temp file name. Otherwise uses a NamedTempFile in the same directory. If no_dereference is true and path is a symlink, writes to the symlink’s target instead of replacing the symlink.