Skip to main content

create_unique_temp_file

Function create_unique_temp_file 

Source
pub fn create_unique_temp_file(
    dir: &Path,
    file_name: &str,
) -> Result<(PathBuf, File), Error>
Expand description

Creates a fresh temp file beside a write target, for a write-then-rename.

The name is hidden (leading dot, so the scanner and watcher skip it), derived from the target’s, and unique per process and call — create_new guarantees no two writers ever share one, which a fixed .{name}.mbr-tmp did not: concurrent writers truncated each other’s temp file and the loser’s rename failed with ENOENT.