[−][src]Function async_std::fs::rename
pub async fn rename<P: AsRef<Path>, Q: AsRef<Path>>(
from: P,
to: Q
) -> Result<()>
Renames a file or directory to a new name, replacing the original if it already exists.
This function is an async version of std::fs::rename
.
Errors
An error will be returned in the following situations (not an exhaustive list):
from
does not exist.from
andto
are on different filesystems.- The current process lacks permissions to rename
from
toto
.
Examples
use async_std::fs; fs::rename("a.txt", "b.txt").await?;