Function std::fs::rename
[−]
[src]
pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> Result<()>
Rename a file or directory to a new name.
This will not work if the new name is on a different mount point.
Errors
This function will return an error if the provided from
doesn't exist, if
the process lacks permissions to view the contents, if from
and to
reside on separate filesystems, or if some other intermittent I/O error
occurs.
Examples
fn main() { use std::fs; fn foo() -> std::io::Result<()> { try!(fs::rename("a.txt", "b.txt")); Ok(()) } }use std::fs; try!(fs::rename("a.txt", "b.txt"));