Stabilize is_symlink()
for Metadata
and Path
This commit is contained in:
parent
e0aaffd8a4
commit
55663a76f4
2 changed files with 3 additions and 5 deletions
|
@ -1021,7 +1021,6 @@ impl Metadata {
|
||||||
///
|
///
|
||||||
#[cfg_attr(unix, doc = "```no_run")]
|
#[cfg_attr(unix, doc = "```no_run")]
|
||||||
#[cfg_attr(not(unix), doc = "```ignore")]
|
#[cfg_attr(not(unix), doc = "```ignore")]
|
||||||
/// #![feature(is_symlink)]
|
|
||||||
/// use std::fs;
|
/// use std::fs;
|
||||||
/// use std::path::Path;
|
/// use std::path::Path;
|
||||||
/// use std::os::unix::fs::symlink;
|
/// use std::os::unix::fs::symlink;
|
||||||
|
@ -1036,7 +1035,7 @@ impl Metadata {
|
||||||
/// Ok(())
|
/// Ok(())
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "is_symlink", issue = "85748")]
|
#[stable(feature = "is_symlink", since = "1.57.0")]
|
||||||
pub fn is_symlink(&self) -> bool {
|
pub fn is_symlink(&self) -> bool {
|
||||||
self.file_type().is_symlink()
|
self.file_type().is_symlink()
|
||||||
}
|
}
|
||||||
|
|
|
@ -2723,7 +2723,7 @@ impl Path {
|
||||||
fs::metadata(self).map(|m| m.is_dir()).unwrap_or(false)
|
fs::metadata(self).map(|m| m.is_dir()).unwrap_or(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if the path exists on disk and is pointing at a symbolic link.
|
/// Returns `true` if the path exists on disk and is pointing at a symbolic link.
|
||||||
///
|
///
|
||||||
/// This function will not traverse symbolic links.
|
/// This function will not traverse symbolic links.
|
||||||
/// In case of a broken symbolic link this will also return true.
|
/// In case of a broken symbolic link this will also return true.
|
||||||
|
@ -2735,7 +2735,6 @@ impl Path {
|
||||||
///
|
///
|
||||||
#[cfg_attr(unix, doc = "```no_run")]
|
#[cfg_attr(unix, doc = "```no_run")]
|
||||||
#[cfg_attr(not(unix), doc = "```ignore")]
|
#[cfg_attr(not(unix), doc = "```ignore")]
|
||||||
/// #![feature(is_symlink)]
|
|
||||||
/// use std::path::Path;
|
/// use std::path::Path;
|
||||||
/// use std::os::unix::fs::symlink;
|
/// use std::os::unix::fs::symlink;
|
||||||
///
|
///
|
||||||
|
@ -2744,7 +2743,7 @@ impl Path {
|
||||||
/// assert_eq!(link_path.is_symlink(), true);
|
/// assert_eq!(link_path.is_symlink(), true);
|
||||||
/// assert_eq!(link_path.exists(), false);
|
/// assert_eq!(link_path.exists(), false);
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "is_symlink", issue = "85748")]
|
#[stable(feature = "is_symlink", since = "1.57.0")]
|
||||||
pub fn is_symlink(&self) -> bool {
|
pub fn is_symlink(&self) -> bool {
|
||||||
fs::symlink_metadata(self).map(|m| m.is_symlink()).unwrap_or(false)
|
fs::symlink_metadata(self).map(|m| m.is_symlink()).unwrap_or(false)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue