Skip to content

Commit

Permalink
Seal Windows FileTypeExt extension trait to allow adding future met…
Browse files Browse the repository at this point in the history
…hods
  • Loading branch information
joshtriplett committed Jun 27, 2022
1 parent e374c91 commit a4cb0b9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion library/std/src/os/windows/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use crate::fs::{self, Metadata, OpenOptions};
use crate::io;
use crate::path::Path;
use crate::sealed::Sealed;
use crate::sys;
use crate::sys_common::{AsInner, AsInnerMut};

Expand Down Expand Up @@ -503,7 +504,7 @@ impl MetadataExt for Metadata {
///
/// On Windows, a symbolic link knows whether it is a file or directory.
#[stable(feature = "windows_file_type_ext", since = "1.64.0")]
pub trait FileTypeExt {
pub trait FileTypeExt: Sealed {
/// Returns `true` if this file type is a symbolic link that is also a directory.
#[stable(feature = "windows_file_type_ext", since = "1.64.0")]
fn is_symlink_dir(&self) -> bool;
Expand All @@ -512,6 +513,9 @@ pub trait FileTypeExt {
fn is_symlink_file(&self) -> bool;
}

#[stable(feature = "windows_file_type_ext", since = "1.64.0")]
impl Sealed for fs::FileType {}

#[stable(feature = "windows_file_type_ext", since = "1.64.0")]
impl FileTypeExt for fs::FileType {
fn is_symlink_dir(&self) -> bool {
Expand Down

0 comments on commit a4cb0b9

Please # to comment.