Skip to main content

write_atomic

Function write_atomic 

Source
pub fn write_atomic(path: &Path, contents: &[u8]) -> Result<()>
Expand description

Write contents to path so a reader sees the old file or the new one, never a short one: a temporary file in the same folder, flushed, then renamed over it.

A settings file that is a symlink (a dotfile manager’s) is written through: the file it points to is replaced and the link stays.