@@ -728,13 +728,14 @@ passing in Rust strings and literals directly, for example).
728
728
* ` rename ` . Take ` AsPath ` bound.
729
729
* ` remove_file ` (renamed from ` unlink ` ). Take ` AsPath ` bound.
730
730
731
- * ` file_attr ` (renamed from ` stat ` ). Take ` AsPath ` bound. Yield a new
732
- struct, ` FileAttr ` , with no public fields, but ` size ` , ` kind ` and
733
- ` permissions ` accessors. The various ` os::platform ` modules will offer
734
- extension methods on this structure.
735
-
736
- * ` set_permissions ` (renamed from ` chmod ` ). Take ` AsPath ` bound, and a
737
- ` FilePermissions ` value. The ` FilePermissions ` type will be revamped
731
+ * ` metadata ` (renamed from ` stat ` ). Take ` AsPath ` bound. Yield a new
732
+ struct, ` Metadata ` , with no public fields, but ` len ` , ` is_dir ` ,
733
+ ` is_file ` , ` perms ` , ` accessed ` and ` modified ` accessors. The various
734
+ ` os::platform ` modules will offer extension methods on this
735
+ structure.
736
+
737
+ * ` set_perms ` (renamed from ` chmod ` ). Take ` AsPath ` bound, and a
738
+ ` Perms ` value. The ` Perms ` type will be revamped
738
739
as a struct with private implementation; see below.
739
740
740
741
** Directories** :
@@ -762,8 +763,8 @@ passing in Rust strings and literals directly, for example).
762
763
The ` File ` type will largely stay as it is today, except that it will
763
764
use the ` AsPath ` bound everywhere.
764
765
765
- The ` stat ` method will be renamed to ` attr ` , yield a ` FileAttr ` , and
766
- take ` &self ` .
766
+ The ` stat ` method will be renamed to ` metadata ` , yield a ` Metadata `
767
+ structure (as described above), and take ` &self ` .
767
768
768
769
The ` fsync ` method will be renamed to ` sync_all ` , and ` datasync ` will be
769
770
renamed to ` sync_data ` . (Although the latter is not available on
@@ -774,39 +775,42 @@ filesystems.)
774
775
The ` path ` method wil remain ` #[unstable] ` , as we do not yet want to
775
776
commit to its API.
776
777
777
- The ` open_opts ` function (renamed from ` open_mode ` ) will take an ` OpenOptions `
778
- struct, which will encompass today's ` FileMode ` and ` FileAccess ` and support a
779
- builder-style API.
778
+ The ` open_mode ` function will be removed in favor of and will take an
779
+ ` OpenOptions ` struct, which will encompass today's ` FileMode ` and
780
+ ` FileAccess ` and support a builder-style API.
780
781
781
782
#### File kinds
782
783
[ File kinds ] : #file-kinds
783
784
784
- The ` FileType ` module will be renamed to ` FileKind ` , and the
785
- underlying ` enum ` will be hidden (to allow for platform differences
786
- and growth). It will expose at least ` is_file ` and ` is_dir ` ; the other
787
- methods need to be audited for compatibility across
785
+ The ` FileType ` type will be removed. As mentioned above, ` is_file ` and
786
+ ` is_dir ` will be provided directly on ` Meatadata ` ; the other types
787
+ need to be audited for compatibility across
788
788
platforms. Platform-specific kinds will be relegated to extension
789
789
traits in ` std::os::platform ` .
790
790
791
+ It's possible that an
792
+ [ extensible] ( https://github.com/rust-lang/rfcs/pull/757 ) ` Kind ` will
793
+ be added in the future.
794
+
791
795
#### File permissions
792
796
[ File permissions ] : #file-permissions
793
797
794
798
The permission models on Unix and Windows vary greatly -- even between
795
799
different filesystems within the same OS. Rather than offer an API
796
800
that has no meaning on some platforms, we will initially provide a
797
- very limited ` FilePermissions ` structure in ` std::fs ` , and then rich
801
+ very limited ` Perms ` structure in ` std::fs ` , and then rich
798
802
extension traits in ` std::os::unix ` and ` std::os::windows ` . Over time,
799
803
if clear cross-platform patterns emerge for richer permissions, we can
800
- grow the ` FilePermissions ` structure.
804
+ grow the ` Perms ` structure.
801
805
802
- On the Unix side, the constructors and accessors for ` FilePermissions `
806
+ On the Unix side, the constructors and accessors for ` Perms `
803
807
will resemble the flags we have today; details are left to the implementation.
804
808
805
809
On the Windows side, initially there will be no extensions, as Windows
806
810
has a very complex permissions model that will take some time to build
807
811
out.
808
812
809
- For ` std::fs ` itself, ` FilePermissions ` will provide constructors and
813
+ For ` std::fs ` itself, ` Perms ` will provide constructors and
810
814
accessors for "world readable" -- and that is all. At the moment, that
811
815
is all that is known to be compatible across the platforms that Rust
812
816
supports.
@@ -819,11 +823,6 @@ This trait will essentially remain stay as it is (renamed from
819
823
820
824
#### Items to move to ` os::platform `
821
825
822
- * ` change_file_times ` will move to ` os::unix ` and remain ` #[unstable] `
823
- * for now* (cf ` SetFileTime ` on Windows). Eventually we will add back
824
- a cross-platform function, when we have grown a notion of time in
825
- ` std ` and have a good compatibility story across all platforms.
826
-
827
826
* ` lstat ` will move to ` os::unix ` and remain ` #[unstable] ` * for now*
828
827
since it is not yet implemented for Windows.
829
828
@@ -834,7 +833,7 @@ This trait will essentially remain stay as it is (renamed from
834
833
function in ` std::fs ` .
835
834
836
835
* In general, offer all of the ` stat ` fields as an extension trait on
837
- ` FileAttr ` (e.g. ` os::unix::FileAttrExt ` ).
836
+ ` Metadata ` (e.g. ` os::unix::MetadataExt ` ).
838
837
839
838
### ` std::net `
840
839
[ std::net ] : #stdnet
0 commit comments