mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Update library/std/src/path.rs
Co-authored-by: Jane Lusby <jlusby42@gmail.com>
This commit is contained in:
parent
55663a76f4
commit
36e050b85f
@ -2743,6 +2743,12 @@ impl Path {
|
||||
/// assert_eq!(link_path.is_symlink(), true);
|
||||
/// assert_eq!(link_path.exists(), false);
|
||||
/// ```
|
||||
///
|
||||
/// # See Also
|
||||
///
|
||||
/// This is a convenience function that coerces errors to false. If you want to
|
||||
/// check errors, call [`fs::symlink_metadata`] and handle its [`Result`]. Then call
|
||||
/// [`fs::Metadata::is_symlink`] if it was [`Ok`].
|
||||
#[stable(feature = "is_symlink", since = "1.57.0")]
|
||||
pub fn is_symlink(&self) -> bool {
|
||||
fs::symlink_metadata(self).map(|m| m.is_symlink()).unwrap_or(false)
|
||||
|
Loading…
Reference in New Issue
Block a user