summaryrefslogtreecommitdiffstats
path: root/library/std/src/os/windows/fs.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/std/src/os/windows/fs.rs')
-rw-r--r--library/std/src/os/windows/fs.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/library/std/src/os/windows/fs.rs b/library/std/src/os/windows/fs.rs
index a091f06dd..94509e547 100644
--- a/library/std/src/os/windows/fs.rs
+++ b/library/std/src/os/windows/fs.rs
@@ -9,7 +9,8 @@ use crate::io;
use crate::path::Path;
use crate::sealed::Sealed;
use crate::sys;
-use crate::sys_common::{AsInner, AsInnerMut};
+use crate::sys_common::{AsInner, AsInnerMut, IntoInner};
+use crate::time::SystemTime;
/// Windows-specific extensions to [`fs::File`].
#[stable(feature = "file_offset", since = "1.15.0")]
@@ -526,6 +527,22 @@ impl FileTypeExt for fs::FileType {
}
}
+/// Windows-specific extensions to [`fs::FileTimes`].
+#[unstable(feature = "file_set_times", issue = "98245")]
+pub trait FileTimesExt: Sealed {
+ /// Set the creation time of a file.
+ #[unstable(feature = "file_set_times", issue = "98245")]
+ fn set_created(self, t: SystemTime) -> Self;
+}
+
+#[unstable(feature = "file_set_times", issue = "98245")]
+impl FileTimesExt for fs::FileTimes {
+ fn set_created(mut self, t: SystemTime) -> Self {
+ self.as_inner_mut().set_created(t.into_inner());
+ self
+ }
+}
+
/// Creates a new symlink to a non-directory file on the filesystem.
///
/// The `link` path will be a file symbolic link pointing to the `original`