Skip to main content

rename_synced

Function rename_synced 

Source
pub fn rename_synced(source: &Path, destination: &Path) -> Result<()>
Expand description

Rename a file or directory and durably sync the affected parents.

A bare rename can vanish on power loss even when the file contents were synced. This syncs the source parent and the destination parent (once when they are the same directory) so the namespace change survives a crash. Cross-filesystem renames fail, like std::fs::rename.

§Errors

Returns an error when the rename fails or either parent cannot be synced. Callers must treat a failed rename as “unknown state” and re-inspect both paths rather than assuming either outcome.