Link try_exists docs to Path::exists

This commit is contained in:
Chris Denton
2022-02-01 17:47:19 +00:00
parent 686663a49e
commit 1bc8f0b49f
2 changed files with 6 additions and 2 deletions

View File

@@ -2288,7 +2288,7 @@ impl AsInnerMut<fs_imp::DirBuilder> for DirBuilder {
/// This function will traverse symbolic links to query information about the /// This function will traverse symbolic links to query information about the
/// destination file. In case of broken symbolic links this will return `Ok(false)`. /// destination file. In case of broken symbolic links this will return `Ok(false)`.
/// ///
/// As opposed to the `exists()` method, this one doesn't silently ignore errors /// As opposed to the [`Path::exists`] method, this one doesn't silently ignore errors
/// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission /// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission
/// denied on some of the parent directories.) /// denied on some of the parent directories.)
/// ///
@@ -2301,6 +2301,8 @@ impl AsInnerMut<fs_imp::DirBuilder> for DirBuilder {
/// assert!(!fs::try_exists("does_not_exist.txt").expect("Can't check existence of file does_not_exist.txt")); /// assert!(!fs::try_exists("does_not_exist.txt").expect("Can't check existence of file does_not_exist.txt"));
/// assert!(fs::try_exists("/root/secret_file.txt").is_err()); /// assert!(fs::try_exists("/root/secret_file.txt").is_err());
/// ``` /// ```
///
/// [`Path::exists`]: crate::path::Path::exists
// FIXME: stabilization should modify documentation of `exists()` to recommend this method // FIXME: stabilization should modify documentation of `exists()` to recommend this method
// instead. // instead.
#[unstable(feature = "path_try_exists", issue = "83186")] #[unstable(feature = "path_try_exists", issue = "83186")]

View File

@@ -2730,7 +2730,7 @@ impl Path {
/// This function will traverse symbolic links to query information about the /// This function will traverse symbolic links to query information about the
/// destination file. In case of broken symbolic links this will return `Ok(false)`. /// destination file. In case of broken symbolic links this will return `Ok(false)`.
/// ///
/// As opposed to the `exists()` method, this one doesn't silently ignore errors /// As opposed to the [`exists()`] method, this one doesn't silently ignore errors
/// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission /// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission
/// denied on some of the parent directories.) /// denied on some of the parent directories.)
/// ///
@@ -2743,6 +2743,8 @@ impl Path {
/// assert!(!Path::new("does_not_exist.txt").try_exists().expect("Can't check existence of file does_not_exist.txt")); /// assert!(!Path::new("does_not_exist.txt").try_exists().expect("Can't check existence of file does_not_exist.txt"));
/// assert!(Path::new("/root/secret_file.txt").try_exists().is_err()); /// assert!(Path::new("/root/secret_file.txt").try_exists().is_err());
/// ``` /// ```
///
/// [`exists()`]: Self::exists
// FIXME: stabilization should modify documentation of `exists()` to recommend this method // FIXME: stabilization should modify documentation of `exists()` to recommend this method
// instead. // instead.
#[unstable(feature = "path_try_exists", issue = "83186")] #[unstable(feature = "path_try_exists", issue = "83186")]