Skip to content

Commit

Permalink
Add alias File::set_modified as shorthand
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtriplett committed Jun 20, 2022
1 parent eb6141e commit 585767d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions library/std/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 585767d

Please sign in to comment.