diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 0500e826768a..4f321cdeeea0 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -638,6 +638,15 @@ impl File { pub fn set_times(&self, times: FileTimes) -> io::Result<()> { self.inner.set_times(times.0) } + + /// Changes the modification time of the underlying file. + /// + /// This is an alias for `set_times(FileTimes::new().set_modified(time))`. + #[unstable(feature = "file_set_times", issue = "98245")] + #[inline] + pub fn set_modified(&self, time: SystemTime) -> io::Result<()> { + self.set_times(FileTimes::new().set_modified(time)) + } } // In addition to the `impl`s here, `File` also has `impl`s for