@@ -1546,6 +1546,8 @@ impl crate::io::IoHandle for File {}
15461546impl Dir {
15471547 /// Attempts to open a directory at `path` in read-only mode.
15481548 ///
1549+ /// This function opens a directory. To open a file instead, see [`File::open`].
1550+ ///
15491551 /// # Errors
15501552 ///
15511553 /// This function will return an error if `path` does not point to an existing directory.
@@ -1573,6 +1575,9 @@ impl Dir {
15731575
15741576 /// Attempts to open a file in read-only mode relative to this directory.
15751577 ///
1578+ /// This function interprets `path` relative to the directory provided by `self`. To open a file
1579+ /// relative to the current working directory, or at an absolute path, see [`File::open`].
1580+ ///
15761581 /// # Errors
15771582 ///
15781583 /// This function will return an error if `path` does not point to an existing file.
@@ -1601,6 +1606,9 @@ impl Dir {
16011606
16021607 /// Attempts to open a file according to `opts` relative to this directory.
16031608 ///
1609+ /// This function interprets `path` relative to the directory provided by `self`. To open a file
1610+ /// relative to the current working directory, or at an absolute path, see [`File::open`].
1611+ ///
16041612 /// # Errors
16051613 ///
16061614 /// This function will return an error if `path` does not point to an existing file.
@@ -1617,7 +1625,7 @@ impl Dir {
16171625 /// let mut opts = OpenOptions::new();
16181626 /// opts.read(true).write(true);
16191627 /// let mut f = dir.open_file_with("bar.txt", &opts)?;
1620- /// f.write (b"Hello, world!")?;
1628+ /// f.write_all (b"Hello, world!")?;
16211629 /// let contents = io::read_to_string(f)?;
16221630 /// assert_eq!(contents, "Hello, world!");
16231631 /// Ok(())
@@ -1630,6 +1638,9 @@ impl Dir {
16301638
16311639 /// Attempts to remove a file relative to this directory.
16321640 ///
1641+ /// This function interprets `path` relative to the directory provided by `self`. To remove a file
1642+ /// relative to the current working directory, or at an absolute path, see [`fs::remove_file`][remove_file].
1643+ ///
16331644 /// # Errors
16341645 ///
16351646 /// This function will return an error if `path` does not point to an existing file.
@@ -1655,6 +1666,9 @@ impl Dir {
16551666 /// Attempts to rename a file or directory relative to this directory to a new name, replacing
16561667 /// the destination file if present.
16571668 ///
1669+ /// This function interprets `from` relative to the directory provided by `self` and `to` relative to the directory
1670+ /// provided by `to_dir`. To rename a file relative to the current working directory, or at an absolute path, see [`fs::rename`][rename].
1671+ ///
16581672 /// # Errors
16591673 ///
16601674 /// This function will return an error if `from` does not point to an existing file or directory.
0 commit comments