Add alias File::set_modified as shorthand

This commit is contained in:
Josh Triplett 2022-06-20 14:37:38 -07:00
parent 61b45c670b
commit 1ac8d5ece3

@ -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