Renames a file or directory to a new name, replacing the original file if `to` already exists. This will not work if the new name is on a different mount point. This is a proxy to [`tokio::fs::rename`].
(&self, from: impl AsRef<Path>, to: impl AsRef<Path>)
| 265 | /// |
| 266 | /// This is a proxy to [`tokio::fs::rename`]. |
| 267 | pub async fn rename(&self, from: impl AsRef<Path>, to: impl AsRef<Path>) -> io::Result<()> { |
| 268 | match self { |
| 269 | Self::Real => fs::rename(from, to).await, |
| 270 | Self::Chroot(root) => fs::rename(append(root.path(), from), append(root.path(), to)).await, |
| 271 | Self::Fake(_) => panic!("unimplemented"), |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | /// Copies the contents of one file to another. This function will also copy the permission bits |
| 276 | /// of the original file to the destination file. |