Function std::fs::renameUnstable [-] [+] [src]

pub fn rename<P: AsPath + ?Sized, Q: AsPath + ?Sized>(from: &P, to: &Q) -> Result<()>

Rename a file or directory to a new name.

Example

fn main() { use std::fs; fs::rename("foo", "bar"); }
use std::fs;

fs::rename("foo", "bar");

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.