Skip to main content

replace_file

Function replace_file 

Source
pub fn replace_file(
    directory: &File,
    source_name: &OsStr,
    target_name: &OsStr,
) -> Result<(), ReplaceFileError>
Expand description

Atomically replace an existing regular file with another regular file in the same directory.

Source contents must already be written. On Windows the implementation reopens and flushes the source through a write-through handle before issuing the NTFS namespace rename through that same handle. On POSIX the caller remains responsible for the containing-directory durability barrier.