Skip to main content

xch

Function xch 

Source
pub fn xch<A: AsRef<Path>, B: AsRef<Path>>(
    path1: A,
    path2: B,
) -> Result<(), Error>
Expand description

Exchange the content of the objects pointed to by the two paths.

This can be used to swap the content of two files, but it also works with directories. This operation is atomic, meaning if the content at one path changed, the other path will also have changed. If the operation can’t be done atomically, it will fail.