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