]> git.lizzy.rs Git - rust.git/commitdiff
Hermit: Add File::set_time stub
authorMartin Kröning <mkroening@posteo.net>
Sun, 4 Sep 2022 22:17:46 +0000 (00:17 +0200)
committerMartin Kröning <mkroening@posteo.net>
Sun, 4 Sep 2022 22:17:46 +0000 (00:17 +0200)
This is not supported on hermit yet. This change is required for compiling std.

library/std/src/sys/hermit/fs.rs

index 1c5efa94bd36ac50fed582ff2fee5da2a7cd23c0..f921839cf529f17cd59ca951b67bbe4d99460c61 100644 (file)
@@ -41,6 +41,9 @@ pub struct OpenOptions {
     mode: i32,
 }
 
+#[derive(Copy, Clone, Debug, Default)]
+pub struct FileTimes {}
+
 pub struct FilePermissions(!);
 
 pub struct FileType(!);
@@ -110,6 +113,11 @@ fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
     }
 }
 
+impl FileTimes {
+    pub fn set_accessed(&mut self, _t: SystemTime) {}
+    pub fn set_modified(&mut self, _t: SystemTime) {}
+}
+
 impl FileType {
     pub fn is_dir(&self) -> bool {
         self.0
@@ -344,6 +352,10 @@ pub fn duplicate(&self) -> io::Result<File> {
     pub fn set_permissions(&self, _perm: FilePermissions) -> io::Result<()> {
         Err(Error::from_raw_os_error(22))
     }
+
+    pub fn set_times(&self, _times: FileTimes) -> io::Result<()> {
+        Err(Error::from_raw_os_error(22))
+    }
 }
 
 impl DirBuilder {