@@ -148,7 +148,7 @@ pub struct OpenOptions(fs_imp::OpenOptions);
148148pub struct Permissions ( fs_imp:: FilePermissions ) ;
149149
150150/// An structure representing a type of file with accessors for each file type.
151- #[ unstable ( feature = "file_type" , reason = "recently added API " ) ]
151+ #[ stable ( feature = "file_type" , since = "1.1.0 " ) ]
152152#[ derive( Copy , Clone , PartialEq , Eq , Hash ) ]
153153pub struct FileType ( fs_imp:: FileType ) ;
154154
@@ -208,14 +208,6 @@ impl File {
208208 OpenOptions :: new ( ) . write ( true ) . create ( true ) . truncate ( true ) . open ( path)
209209 }
210210
211- /// Returns `None`.
212- #[ unstable( feature = "file_path" ,
213- reason = "this abstraction was imposed by this library and was removed" ) ]
214- #[ deprecated( since = "1.0.0" , reason = "abstraction was removed" ) ]
215- pub fn path ( & self ) -> Option < & Path > {
216- None
217- }
218-
219211 /// Attempts to sync all OS-internal metadata to disk.
220212 ///
221213 /// This function will attempt to ensure that all in-core data reaches the
@@ -501,7 +493,7 @@ impl AsInnerMut<fs_imp::OpenOptions> for OpenOptions {
501493
502494impl Metadata {
503495 /// Returns the file type for this metadata.
504- #[ unstable ( feature = "file_type" , reason = "recently added API " ) ]
496+ #[ stable ( feature = "file_type" , since = "1.1.0 " ) ]
505497 pub fn file_type ( & self ) -> FileType {
506498 FileType ( self . 0 . file_type ( ) )
507499 }
@@ -575,38 +567,6 @@ impl Metadata {
575567 pub fn permissions ( & self ) -> Permissions {
576568 Permissions ( self . 0 . perm ( ) )
577569 }
578-
579- /// Returns the most recent access time for a file.
580- ///
581- /// The return value is in milliseconds since the epoch.
582- #[ unstable( feature = "fs_time" ,
583- reason = "the return type of u64 is not quite appropriate for \
584- this method and may change if the standard library \
585- gains a type to represent a moment in time") ]
586- #[ deprecated( since = "1.1.0" ,
587- reason = "use os::platform::fs::MetadataExt extension traits" ) ]
588- pub fn accessed ( & self ) -> u64 {
589- self . adjust_time ( self . 0 . accessed ( ) )
590- }
591-
592- /// Returns the most recent modification time for a file.
593- ///
594- /// The return value is in milliseconds since the epoch.
595- #[ unstable( feature = "fs_time" ,
596- reason = "the return type of u64 is not quite appropriate for \
597- this method and may change if the standard library \
598- gains a type to represent a moment in time") ]
599- #[ deprecated( since = "1.1.0" ,
600- reason = "use os::platform::fs::MetadataExt extension traits" ) ]
601- pub fn modified ( & self ) -> u64 {
602- self . adjust_time ( self . 0 . modified ( ) )
603- }
604-
605- fn adjust_time ( & self , val : u64 ) -> u64 {
606- // FILETIME (what `val` represents) is in 100ns intervals and there are
607- // 10000 intervals in a millisecond.
608- if cfg ! ( windows) { val / 10000 } else { val}
609- }
610570}
611571
612572impl AsInner < fs_imp:: FileAttr > for Metadata {
@@ -663,15 +623,17 @@ impl Permissions {
663623 }
664624}
665625
666- #[ unstable( feature = "file_type" , reason = "recently added API" ) ]
667626impl FileType {
668627 /// Test whether this file type represents a directory.
628+ #[ stable( feature = "file_type" , since = "1.1.0" ) ]
669629 pub fn is_dir ( & self ) -> bool { self . 0 . is_dir ( ) }
670630
671631 /// Test whether this file type represents a regular file.
632+ #[ stable( feature = "file_type" , since = "1.1.0" ) ]
672633 pub fn is_file ( & self ) -> bool { self . 0 . is_file ( ) }
673634
674635 /// Test whether this file type represents a symbolic link.
636+ #[ stable( feature = "file_type" , since = "1.1.0" ) ]
675637 pub fn is_symlink ( & self ) -> bool { self . 0 . is_symlink ( ) }
676638}
677639
@@ -736,7 +698,7 @@ impl DirEntry {
736698 /// On Windows this function is cheap to call (no extra system calls
737699 /// needed), but on Unix platforms this function is the equivalent of
738700 /// calling `symlink_metadata` on the path.
739- #[ unstable ( feature = "dir_entry_ext" , reason = "recently added API " ) ]
701+ #[ stable ( feature = "dir_entry_ext" , since = "1.1.0 " ) ]
740702 pub fn metadata ( & self ) -> io:: Result < Metadata > {
741703 self . 0 . metadata ( ) . map ( Metadata )
742704 }
@@ -751,14 +713,14 @@ impl DirEntry {
751713 /// On Windows and most Unix platforms this function is free (no extra
752714 /// system calls needed), but some Unix platforms may require the equivalent
753715 /// call to `symlink_metadata` to learn about the target file type.
754- #[ unstable ( feature = "dir_entry_ext" , reason = "recently added API " ) ]
716+ #[ stable ( feature = "dir_entry_ext" , since = "1.1.0 " ) ]
755717 pub fn file_type ( & self ) -> io:: Result < FileType > {
756718 self . 0 . file_type ( ) . map ( FileType )
757719 }
758720
759721 /// Returns the bare file name of this directory entry without any other
760722 /// leading path component.
761- #[ unstable ( feature = "dir_entry_ext" , reason = "recently added API " ) ]
723+ #[ stable ( feature = "dir_entry_ext" , since = "1.1.0 " ) ]
762724 pub fn file_name ( & self ) -> OsString {
763725 self . 0 . file_name ( )
764726 }
@@ -828,7 +790,6 @@ pub fn metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> {
828790/// # Examples
829791///
830792/// ```rust
831- /// #![feature(symlink_metadata)]
832793/// # fn foo() -> std::io::Result<()> {
833794/// use std::fs;
834795///
@@ -837,7 +798,7 @@ pub fn metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> {
837798/// # Ok(())
838799/// # }
839800/// ```
840- #[ unstable ( feature = "symlink_metadata" , reason = "recently added API " ) ]
801+ #[ stable ( feature = "symlink_metadata" , since = "1.1.0 " ) ]
841802pub fn symlink_metadata < P : AsRef < Path > > ( path : P ) -> io:: Result < Metadata > {
842803 fs_imp:: lstat ( path. as_ref ( ) ) . map ( Metadata )
843804}
@@ -1268,7 +1229,6 @@ pub fn set_file_times<P: AsRef<Path>>(path: P, accessed: u64,
12681229/// # Examples
12691230///
12701231/// ```
1271- /// # #![feature(fs)]
12721232/// # fn foo() -> std::io::Result<()> {
12731233/// use std::fs;
12741234///
@@ -1284,14 +1244,13 @@ pub fn set_file_times<P: AsRef<Path>>(path: P, accessed: u64,
12841244/// This function will return an error if the provided `path` doesn't exist, if
12851245/// the process lacks permissions to change the attributes of the file, or if
12861246/// some other I/O error is encountered.
1287- #[ unstable( feature = "fs" ,
1288- reason = "a more granual ability to set specific permissions may \
1289- be exposed on the Permissions structure itself and this \
1290- method may not always exist") ]
1291- pub fn set_permissions < P : AsRef < Path > > ( path : P , perm : Permissions ) -> io:: Result < ( ) > {
1247+ #[ stable( feature = "set_permissions" , since = "1.1.0" ) ]
1248+ pub fn set_permissions < P : AsRef < Path > > ( path : P , perm : Permissions )
1249+ -> io:: Result < ( ) > {
12921250 fs_imp:: set_perm ( path. as_ref ( ) , perm. 0 )
12931251}
12941252
1253+ #[ unstable( feature = "dir_builder" , reason = "recently added API" ) ]
12951254impl DirBuilder {
12961255 /// Creates a new set of options with default mode/security settings for all
12971256 /// platforms and also non-recursive.
@@ -2064,9 +2023,24 @@ mod tests {
20642023 // These numbers have to be bigger than the time in the day to account
20652024 // for timezones Windows in particular will fail in certain timezones
20662025 // with small enough values
2067- check ! ( fs:: set_file_times( & path, 100000 , 200000 ) ) ;
2068- assert_eq ! ( check!( path. metadata( ) ) . accessed( ) , 100000 ) ;
2069- assert_eq ! ( check!( path. metadata( ) ) . modified( ) , 200000 ) ;
2026+ check ! ( fs:: set_file_times( & path, 100_000 , 200_000 ) ) ;
2027+
2028+ check ( & check ! ( path. metadata( ) ) ) ;
2029+
2030+ #[ cfg( unix) ]
2031+ fn check ( metadata : & fs:: Metadata ) {
2032+ use os:: unix:: prelude:: * ;
2033+ assert_eq ! ( metadata. atime( ) , 100 ) ;
2034+ assert_eq ! ( metadata. atime_nsec( ) , 0 ) ;
2035+ assert_eq ! ( metadata. mtime( ) , 200 ) ;
2036+ assert_eq ! ( metadata. mtime_nsec( ) , 0 ) ;
2037+ }
2038+ #[ cfg( windows) ]
2039+ fn check ( metadata : & fs:: Metadata ) {
2040+ use os:: windows:: prelude:: * ;
2041+ assert_eq ! ( metadata. last_access_time( ) , 100_000 * 10_000 ) ;
2042+ assert_eq ! ( metadata. last_write_time( ) , 200_000 * 10_000 ) ;
2043+ }
20702044 }
20712045
20722046 #[ test]
0 commit comments