]> git.lizzy.rs Git - rust.git/blob - src/libstd/sys/cloudabi/shims/fs.rs
Rollup merge of #47277 - tspiteri:log-correctness, r=frewsxcv
[rust.git] / src / libstd / sys / cloudabi / shims / fs.rs
1 // Copyright 2017 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 impl fmt::Debug for FilePermissions {
94     fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
95         match self.0 {}
96     }
97 }
98
99 impl FileType {
100     pub fn is_dir(&self) -> bool {
101         match self.0 {}
102     }
103
104     pub fn is_file(&self) -> bool {
105         match self.0 {}
106     }
107
108     pub fn is_symlink(&self) -> bool {
109         match self.0 {}
110     }
111 }
112
113 impl Clone for FileType {
114     fn clone(&self) -> FileType {
115         match self.0 {}
116     }
117 }
118
119 impl Copy for FileType {}
120
121 impl PartialEq for FileType {
122     fn eq(&self, _other: &FileType) -> bool {
123         match self.0 {}
124     }
125 }
126
127 impl Eq for FileType {}
128
129 impl Hash for FileType {
130     fn hash<H: Hasher>(&self, _h: &mut H) {
131         match self.0 {}
132     }
133 }
134
135 impl fmt::Debug for FileType {
136     fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
137         match self.0 {}
138     }
139 }
140
141 impl fmt::Debug for ReadDir {
142     fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
143         match self.0 {}
144     }
145 }
146
147 impl Iterator for ReadDir {
148     type Item = io::Result<DirEntry>;
149
150     fn next(&mut self) -> Option<io::Result<DirEntry>> {
151         match self.0 {}
152     }
153 }
154
155 impl DirEntry {
156     pub fn path(&self) -> PathBuf {
157         match self.0 {}
158     }
159
160     pub fn file_name(&self) -> OsString {
161         match self.0 {}
162     }
163
164     pub fn metadata(&self) -> io::Result<FileAttr> {
165         match self.0 {}
166     }
167
168     pub fn file_type(&self) -> io::Result<FileType> {
169         match self.0 {}
170     }
171 }
172
173 impl OpenOptions {
174     pub fn new() -> OpenOptions {
175         OpenOptions {}
176     }
177
178     pub fn read(&mut self, _read: bool) {}
179     pub fn write(&mut self, _write: bool) {}
180     pub fn append(&mut self, _append: bool) {}
181     pub fn truncate(&mut self, _truncate: bool) {}
182     pub fn create(&mut self, _create: bool) {}
183     pub fn create_new(&mut self, _create_new: bool) {}
184 }
185
186 impl File {
187     pub fn open(_path: &Path, _opts: &OpenOptions) -> io::Result<File> {
188         unsupported()
189     }
190
191     pub fn file_attr(&self) -> io::Result<FileAttr> {
192         match self.0 {}
193     }
194
195     pub fn fsync(&self) -> io::Result<()> {
196         match self.0 {}
197     }
198
199     pub fn datasync(&self) -> io::Result<()> {
200         match self.0 {}
201     }
202
203     pub fn truncate(&self, _size: u64) -> io::Result<()> {
204         match self.0 {}
205     }
206
207     pub fn read(&self, _buf: &mut [u8]) -> io::Result<usize> {
208         match self.0 {}
209     }
210
211     pub fn write(&self, _buf: &[u8]) -> io::Result<usize> {
212         match self.0 {}
213     }
214
215     pub fn flush(&self) -> io::Result<()> {
216         match self.0 {}
217     }
218
219     pub fn seek(&self, _pos: SeekFrom) -> io::Result<u64> {
220         match self.0 {}
221     }
222
223     pub fn duplicate(&self) -> io::Result<File> {
224         match self.0 {}
225     }
226
227     pub fn set_permissions(&self, _perm: FilePermissions) -> io::Result<()> {
228         match self.0 {}
229     }
230
231     pub fn diverge(&self) -> ! {
232         match self.0 {}
233     }
234 }
235
236 impl DirBuilder {
237     pub fn new() -> DirBuilder {
238         DirBuilder {}
239     }
240
241     pub fn mkdir(&self, _p: &Path) -> io::Result<()> {
242         unsupported()
243     }
244 }
245
246 impl fmt::Debug for File {
247     fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
248         match self.0 {}
249     }
250 }
251
252 pub fn readdir(_p: &Path) -> io::Result<ReadDir> {
253     unsupported()
254 }
255
256 pub fn unlink(_p: &Path) -> io::Result<()> {
257     unsupported()
258 }
259
260 pub fn rename(_old: &Path, _new: &Path) -> io::Result<()> {
261     unsupported()
262 }
263
264 pub fn set_perm(_p: &Path, perm: FilePermissions) -> io::Result<()> {
265     match perm.0 {}
266 }
267
268 pub fn rmdir(_p: &Path) -> io::Result<()> {
269     unsupported()
270 }
271
272 pub fn remove_dir_all(_path: &Path) -> io::Result<()> {
273     unsupported()
274 }
275
276 pub fn readlink(_p: &Path) -> io::Result<PathBuf> {
277     unsupported()
278 }
279
280 pub fn symlink(_src: &Path, _dst: &Path) -> io::Result<()> {
281     unsupported()
282 }
283
284 pub fn link(_src: &Path, _dst: &Path) -> io::Result<()> {
285     unsupported()
286 }
287
288 pub fn stat(_p: &Path) -> io::Result<FileAttr> {
289     unsupported()
290 }
291
292 pub fn lstat(_p: &Path) -> io::Result<FileAttr> {
293     unsupported()
294 }
295
296 pub fn canonicalize(_p: &Path) -> io::Result<PathBuf> {
297     unsupported()
298 }
299
300 pub fn copy(_from: &Path, _to: &Path) -> io::Result<u64> {
301     unsupported()
302 }