pub fn rename_no_replace(from: &Path, to: &Path) -> Result<()>Expand description
Rename from to to, failing with AlreadyExists instead of replacing
an existing to.
std::fs::rename replaces an existing destination on every platform, so
checking first and renaming after would let a file created in between be
silently overwritten. Each OS has an atomic no-replace rename; where the
filesystem doesn’t support it, this falls back to check-then-rename.