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.
Errors
This function will return an error if the provided from
`fromdoesn't exist, if the process lacks permissions to view the contents, if
` doesn't exist, if
the process lacks permissions to view the contents, if from
`fromand
` and to
`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"));