From 35428cff60d4bdb8b2bcc4a55746b5543d4d47f4 Mon Sep 17 00:00:00 2001 From: Julius Liu Date: Mon, 5 Jun 2023 15:59:29 -0700 Subject: feat: adding ext that returns change_time for Windows --- library/std/src/os/windows/fs.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'library/std/src/os') diff --git a/library/std/src/os/windows/fs.rs b/library/std/src/os/windows/fs.rs index 27947d91c99..7cac8c39ea8 100644 --- a/library/std/src/os/windows/fs.rs +++ b/library/std/src/os/windows/fs.rs @@ -471,6 +471,13 @@ pub trait MetadataExt { /// `fs::metadata` or `File::metadata`, then this will return `Some`. #[unstable(feature = "windows_by_handle", issue = "63010")] fn file_index(&self) -> Option; + + /// Returns the change time, which is the last time file metadata was changed, such as + /// renames, attributes, etc + /// + /// This will return `None` if the `Metadata` instance was not created using the `FILE_BASIC_INFO` type. + #[unstable(feature = "windows_change_time", issue = "121478")] + fn change_time(&self) -> Option; } #[stable(feature = "metadata_ext", since = "1.1.0")] @@ -499,6 +506,9 @@ impl MetadataExt for Metadata { fn file_index(&self) -> Option { self.as_inner().file_index() } + fn change_time(&self) -> Option { + self.as_inner().changed_u64() + } } /// Windows-specific extensions to [`fs::FileType`]. -- cgit 1.4.1-3-g733a5