Closed
Description
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
- Implementation: Support setting file accessed/modified timestamps #98246
- Add creation time support to
FileTimes
on apple and windows #109773 - Final comment period (FCP)
- Stabilization PR