]> git.lizzy.rs Git - rust.git/blob - src/libstd/sys/sgx/fs.rs
Add x86_64-fortanix-unknown-sgx target to libstd and dependencies
[rust.git] / src / libstd / sys / sgx / fs.rs
1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 use ffi::OsString;
12 use fmt;
13 use hash::{Hash, Hasher};
14 use io::{self, SeekFrom};
15 use path::{Path, PathBuf};
16 use sys::time::SystemTime;
17 use sys::{unsupported, Void};
18
19 pub struct File(Void);
20
21 pub struct FileAttr(Void);
22
23 pub struct ReadDir(Void);
24
25 pub struct DirEntry(Void);
26
27 #[derive(Clone, Debug)]
28 pub struct OpenOptions { }
29
30 pub struct FilePermissions(Void);
31
32 pub struct FileType(Void);
33
34 #[derive(Debug)]
35 pub struct DirBuilder { }
36
37 impl FileAttr {
38     pub fn size(&self) -> u64 {
39         match self.0 {}
40     }
41
42     pub fn perm(&self) -> FilePermissions {
43         match self.0 {}
44     }
45
46     pub fn file_type(&self) -> FileType {
47         match self.0 {}
48     }
49
50     pub fn modified(&self) -> io::Result<SystemTime> {
51         match self.0 {}
52     }
53
54     pub fn accessed(&self) -> io::Result<SystemTime> {
55         match self.0 {}
56     }
57
58     pub fn created(&self) -> io::Result<SystemTime> {
59         match self.0 {}
60     }
61 }
62
63 impl Clone for FileAttr {
64     fn clone(&self) -> FileAttr {
65         match self.0 {}
66     }
67 }
68
69 impl FilePermissions {
70     pub fn readonly(&self) -> bool {
71         match self.0 {}
72     }
73
74     pub fn set_readonly(&mut self, _readonly: bool) {
75         match self.0 {}
76     }
77 }
78
79 impl Clone for FilePermissions {
80     fn clone(&self) -> FilePermissions {
81         match self.0 {}
82     }
83 }
84
85 impl PartialEq for FilePermissions {
86     fn eq(&self, _other: &FilePermissions) -> bool {
87         match self.0 {}
88     }
89 }
90
91 impl Eq for FilePermissions {
92 }
93
94 impl fmt::Debug for FilePermissions {
95     fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
96         match self.0 {}
97     }
98 }
99
100 impl FileType {
101     pub fn is_dir(&self) -> bool {
102         match self.0 {}
103     }
104
105     pub fn is_file(&self) -> bool {
106         match self.0 {}
107     }
108
109     pub fn is_symlink(&self) -> bool {
110         match self.0 {}
111     }
112 }
113
114 impl Clone for FileType {
115     fn clone(&self) -> FileType {
116         match self.0 {}
117     }
118 }
119
120 impl Copy for FileType {}
121
122 impl PartialEq for FileType {
123     fn eq(&self, _other: &FileType) -> bool {
124         match self.0 {}
125     }
126 }
127
128 impl Eq for FileType {
129 }
130
131 impl Hash for FileType {
132     fn hash<H: Hasher>(&self, _h: &mut H) {
133         match self.0 {}
134     }
135 }
136
137 impl fmt::Debug for FileType {
138     fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
139         match self.0 {}
140     }
141 }
142
143 impl fmt::Debug for ReadDir {
144     fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
145         match self.0 {}
146     }
147 }
148
149 impl Iterator for ReadDir {
150     type Item = io::Result<DirEntry>;
151
152     fn next(&mut self) -> Option<io::Result<DirEntry>> {
153         match self.0 {}
154     }
155 }
156
157 impl DirEntry {
158     pub fn path(&self) -> PathBuf {
159         match self.0 {}
160     }
161
162     pub fn file_name(&self) -> OsString {
163         match self.0 {}
164     }
165
166     pub fn metadata(&self) -> io::Result<FileAttr> {
167         match self.0 {}
168     }
169
170     pub fn file_type(&self) -> io::Result<FileType> {
171         match self.0 {}
172     }
173 }
174
175 impl OpenOptions {
176     pub fn new() -> OpenOptions {
177         OpenOptions { }
178     }
179
180     pub fn read(&mut self, _read: bool) { }
181     pub fn write(&mut self, _write: bool) { }
182     pub fn append(&mut self, _append: bool) { }
183     pub fn truncate(&mut self, _truncate: bool) { }
184     pub fn create(&mut self, _create: bool) { }
185     pub fn create_new(&mut self, _create_new: bool) { }
186 }
187
188 impl File {
189     pub fn open(_path: &Path, _opts: &OpenOptions) -> io::Result<File> {
190         unsupported()
191     }
192
193     pub fn file_attr(&self) -> io::Result<FileAttr> {
194         match self.0 {}
195     }
196
197     pub fn fsync(&self) -> io::Result<()> {
198         match self.0 {}
199     }
200
201     pub fn datasync(&self) -> io::Result<()> {
202         match self.0 {}
203     }
204
205     pub fn truncate(&self, _size: u64) -> io::Result<()> {
206         match self.0 {}
207     }
208
209     pub fn read(&self, _buf: &mut [u8]) -> io::Result<usize> {
210         match self.0 {}
211     }
212
213     pub fn write(&self, _buf: &[u8]) -> io::Result<usize> {
214         match self.0 {}
215     }
216
217     pub fn flush(&self) -> io::Result<()> {
218         match self.0 {}
219     }
220
221     pub fn seek(&self, _pos: SeekFrom) -> io::Result<u64> {
222         match self.0 {}
223     }
224
225     pub fn duplicate(&self) -> io::Result<File> {
226         match self.0 {}
227     }
228
229     pub fn set_permissions(&self, _perm: FilePermissions) -> io::Result<()> {
230         match self.0 {}
231     }
232
233     pub fn diverge(&self) -> ! {
234         match self.0 {}
235     }
236 }
237
238 impl DirBuilder {
239     pub fn new() -> DirBuilder {
240         DirBuilder { }
241     }
242
243     pub fn mkdir(&self, _p: &Path) -> io::Result<()> {
244         unsupported()
245     }
246 }
247
248 impl fmt::Debug for File {
249     fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
250         match self.0 {}
251     }
252 }
253
254 pub fn readdir(_p: &Path) -> io::Result<ReadDir> {
255     unsupported()
256 }
257
258 pub fn unlink(_p: &Path) -> io::Result<()> {
259     unsupported()
260 }
261
262 pub fn rename(_old: &Path, _new: &Path) -> io::Result<()> {
263     unsupported()
264 }
265
266 pub fn set_perm(_p: &Path, perm: FilePermissions) -> io::Result<()> {
267     match perm.0 {}
268 }
269
270 pub fn rmdir(_p: &Path) -> io::Result<()> {
271     unsupported()
272 }
273
274 pub fn remove_dir_all(_path: &Path) -> io::Result<()> {
275     unsupported()
276 }
277
278 pub fn readlink(_p: &Path) -> io::Result<PathBuf> {
279     unsupported()
280 }
281
282 pub fn symlink(_src: &Path, _dst: &Path) -> io::Result<()> {
283     unsupported()
284 }
285
286 pub fn link(_src: &Path, _dst: &Path) -> io::Result<()> {
287     unsupported()
288 }
289
290 pub fn stat(_p: &Path) -> io::Result<FileAttr> {
291     unsupported()
292 }
293
294 pub fn lstat(_p: &Path) -> io::Result<FileAttr> {
295     unsupported()
296 }
297
298 pub fn canonicalize(_p: &Path) -> io::Result<PathBuf> {
299     unsupported()
300 }
301
302 pub fn copy(_from: &Path, _to: &Path) -> io::Result<u64> {
303     unsupported()
304 }