Function renamore::rename_exclusive_fallback
source · pub fn rename_exclusive_fallback<F: AsRef<Path>, T: AsRef<Path>>(
from: F,
to: T
) -> Result<bool>
Expand description
Rename a file without overwriting the destination path if it exists, using a non-atomic fallback if necessary.
This is similar to rename_exclusive
except that if performing the
operation atomically is not supported, then a non-atomic fallback
implementation based on try_exists
and rename
will be used.
Examples
if renamore::rename_exclusive_fallback("old.txt", "new.txt")? {
// `new.txt` was definitely not overwritten.
println!("The operation was atomic");
} else {
// `new.txt` was probably not overwritten.
println!("The operation was not atomic");
}