pub fn file_rename(
src: &Path,
dst: &Path,
force: bool,
mode: ApplyMode,
guard: Option<&PathGuard>,
) -> Result<EditResult>Expand description
Rename (move) a file, real directory, symlink, FIFO, socket, or device node (#2091, #2538).
Files and real directories can be renamed. Destination exists without
--force is already_exists. Symlinks (including dangling and symlink-to-dir)
are moved as directory entries without following the target. Soft-loading
symlink text and rewriting would mutate the target via atomic_write;
special nodes use an empty path-only snapshot so write policies never
rewrite the link target. Regular-file content is soft-loaded for
preview/diff; binary / invalid UTF-8 still path-rename (#2031).
Guard: both src and dst use entry containment
(PathGuard::check_path_entry) so a link whose target is outside the
workspace can still be renamed when the entry paths stay inside
(#2115).