persist_temp_file

Function persist_temp_file 

Source
pub fn persist_temp_file<P: AsRef<Path>>(
    temp_file: NamedTempFile,
    new_path: P,
) -> Result<File>
Expand description

Persists the temporary file after synchronizing the content.

After system crash, the persisted file should have a valid content if existed. However, the persisted file name (or directory entry) could be lost. It’s up to caller to synchronize the directory entries.

See also https://lwn.net/Articles/457667/ for the behavior on Linux.