Function std::fs::renameStable [-] [+] [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 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

extern crate std; 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"));