File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -844,6 +844,9 @@ pub fn symlink_metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> {
844
844
845
845
/// Rename a file or directory to a new name.
846
846
///
847
+ /// Moving a file or directory is also a rename, in a sense, and so this
848
+ /// function is not limited a single directory.
849
+ ///
847
850
/// # Errors
848
851
///
849
852
/// This function will return an error if the provided `from` doesn't exist, if
@@ -861,6 +864,17 @@ pub fn symlink_metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> {
861
864
/// # Ok(())
862
865
/// # }
863
866
/// ```
867
+ ///
868
+ /// Moving:
869
+ ///
870
+ /// ```
871
+ /// use std::fs;
872
+ ///
873
+ /// # fn foo() -> std::io::Result<()> {
874
+ /// try!(fs::rename("from/a.txt", "to/b.txt"));
875
+ /// # Ok(())
876
+ /// # }
877
+ /// ```
864
878
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
865
879
pub fn rename < P : AsRef < Path > , Q : AsRef < Path > > ( from : P , to : Q ) -> io:: Result < ( ) > {
866
880
fs_imp:: rename ( from. as_ref ( ) , to. as_ref ( ) )
You can’t perform that action at this time.
0 commit comments