Feature gate: #![feature(file_set_times)]
This is a tracking issue for setting file accesses/modification timestamps via the File::set_times function and associated FileTimes structure.
Public API
// std::fs
#[derive(Copy, Clone, Debug, Default)]
pub struct FileTimes { /* ... */ };
impl FileTimes {
pub fn new() -> Self;
pub fn set_accessed(self, t: SystemTime) -> Self;
pub fn set_modified(self, t: SystemTime) -> Self;
}
impl File {
pub fn set_times(&self, times: FileTimes) -> std::io::Result<()>;
pub fn set_modified(&self, t: SystemTime) -> std::io::Result<()>;
}
// std::os::ios::fs
// std::os::macos::fs
// std::os::watchos::fs
// std::os::windows::fs
pub trait FileTimesExt: Sealed {
fn set_created(self, t: SystemTime) -> Self;
}
impl FileTimesExt for std::fs::FileTimes;
Steps / History
Feature gate:
#![feature(file_set_times)]This is a tracking issue for setting file accesses/modification timestamps via the
File::set_timesfunction and associatedFileTimesstructure.Public API
Steps / History
FileTimeson apple and windows #109773