xref: /drstd/src/std/sys/unsupported/fs.rs (revision 9670759b785600bf6315e4173e46a602f16add7a)
1 use crate::std::ffi::OsString;
2 use crate::std::fmt;
3 use crate::std::hash::{Hash, Hasher};
4 use crate::std::io::{self, BorrowedCursor, IoSlice, IoSliceMut, SeekFrom};
5 use crate::std::path::{Path, PathBuf};
6 use crate::std::sys::time::SystemTime;
7 use crate::std::sys::unsupported;
8 
9 pub struct File(!);
10 
11 pub struct FileAttr(!);
12 
13 pub struct ReadDir(!);
14 
15 pub struct DirEntry(!);
16 
17 #[derive(Clone, Debug)]
18 pub struct OpenOptions {}
19 
20 #[derive(Copy, Clone, Debug, Default)]
21 pub struct FileTimes {}
22 
23 pub struct FilePermissions(!);
24 
25 pub struct FileType(!);
26 
27 #[derive(Debug)]
28 pub struct DirBuilder {}
29 
30 impl FileAttr {
size(&self) -> u6431     pub fn size(&self) -> u64 {
32         self.0
33     }
34 
perm(&self) -> FilePermissions35     pub fn perm(&self) -> FilePermissions {
36         self.0
37     }
38 
file_type(&self) -> FileType39     pub fn file_type(&self) -> FileType {
40         self.0
41     }
42 
modified(&self) -> io::Result<SystemTime>43     pub fn modified(&self) -> io::Result<SystemTime> {
44         self.0
45     }
46 
accessed(&self) -> io::Result<SystemTime>47     pub fn accessed(&self) -> io::Result<SystemTime> {
48         self.0
49     }
50 
created(&self) -> io::Result<SystemTime>51     pub fn created(&self) -> io::Result<SystemTime> {
52         self.0
53     }
54 }
55 
56 impl Clone for FileAttr {
clone(&self) -> FileAttr57     fn clone(&self) -> FileAttr {
58         self.0
59     }
60 }
61 
62 impl FilePermissions {
readonly(&self) -> bool63     pub fn readonly(&self) -> bool {
64         self.0
65     }
66 
set_readonly(&mut self, _readonly: bool)67     pub fn set_readonly(&mut self, _readonly: bool) {
68         self.0
69     }
70 }
71 
72 impl Clone for FilePermissions {
clone(&self) -> FilePermissions73     fn clone(&self) -> FilePermissions {
74         self.0
75     }
76 }
77 
78 impl PartialEq for FilePermissions {
eq(&self, _other: &FilePermissions) -> bool79     fn eq(&self, _other: &FilePermissions) -> bool {
80         self.0
81     }
82 }
83 
84 impl Eq for FilePermissions {}
85 
86 impl fmt::Debug for FilePermissions {
fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result87     fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
88         self.0
89     }
90 }
91 
92 impl FileTimes {
set_accessed(&mut self, _t: SystemTime)93     pub fn set_accessed(&mut self, _t: SystemTime) {}
set_modified(&mut self, _t: SystemTime)94     pub fn set_modified(&mut self, _t: SystemTime) {}
95 }
96 
97 impl FileType {
is_dir(&self) -> bool98     pub fn is_dir(&self) -> bool {
99         self.0
100     }
101 
is_file(&self) -> bool102     pub fn is_file(&self) -> bool {
103         self.0
104     }
105 
is_symlink(&self) -> bool106     pub fn is_symlink(&self) -> bool {
107         self.0
108     }
109 }
110 
111 impl Clone for FileType {
clone(&self) -> FileType112     fn clone(&self) -> FileType {
113         self.0
114     }
115 }
116 
117 impl Copy for FileType {}
118 
119 impl PartialEq for FileType {
eq(&self, _other: &FileType) -> bool120     fn eq(&self, _other: &FileType) -> bool {
121         self.0
122     }
123 }
124 
125 impl Eq for FileType {}
126 
127 impl Hash for FileType {
hash<H: Hasher>(&self, _h: &mut H)128     fn hash<H: Hasher>(&self, _h: &mut H) {
129         self.0
130     }
131 }
132 
133 impl fmt::Debug for FileType {
fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result134     fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
135         self.0
136     }
137 }
138 
139 impl fmt::Debug for ReadDir {
fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result140     fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
141         self.0
142     }
143 }
144 
145 impl Iterator for ReadDir {
146     type Item = io::Result<DirEntry>;
147 
next(&mut self) -> Option<io::Result<DirEntry>>148     fn next(&mut self) -> Option<io::Result<DirEntry>> {
149         self.0
150     }
151 }
152 
153 impl DirEntry {
path(&self) -> PathBuf154     pub fn path(&self) -> PathBuf {
155         self.0
156     }
157 
file_name(&self) -> OsString158     pub fn file_name(&self) -> OsString {
159         self.0
160     }
161 
metadata(&self) -> io::Result<FileAttr>162     pub fn metadata(&self) -> io::Result<FileAttr> {
163         self.0
164     }
165 
file_type(&self) -> io::Result<FileType>166     pub fn file_type(&self) -> io::Result<FileType> {
167         self.0
168     }
169 }
170 
171 impl OpenOptions {
new() -> OpenOptions172     pub fn new() -> OpenOptions {
173         OpenOptions {}
174     }
175 
read(&mut self, _read: bool)176     pub fn read(&mut self, _read: bool) {}
write(&mut self, _write: bool)177     pub fn write(&mut self, _write: bool) {}
append(&mut self, _append: bool)178     pub fn append(&mut self, _append: bool) {}
truncate(&mut self, _truncate: bool)179     pub fn truncate(&mut self, _truncate: bool) {}
create(&mut self, _create: bool)180     pub fn create(&mut self, _create: bool) {}
create_new(&mut self, _create_new: bool)181     pub fn create_new(&mut self, _create_new: bool) {}
182 }
183 
184 impl File {
open(_path: &Path, _opts: &OpenOptions) -> io::Result<File>185     pub fn open(_path: &Path, _opts: &OpenOptions) -> io::Result<File> {
186         unsupported()
187     }
188 
file_attr(&self) -> io::Result<FileAttr>189     pub fn file_attr(&self) -> io::Result<FileAttr> {
190         self.0
191     }
192 
fsync(&self) -> io::Result<()>193     pub fn fsync(&self) -> io::Result<()> {
194         self.0
195     }
196 
datasync(&self) -> io::Result<()>197     pub fn datasync(&self) -> io::Result<()> {
198         self.0
199     }
200 
truncate(&self, _size: u64) -> io::Result<()>201     pub fn truncate(&self, _size: u64) -> io::Result<()> {
202         self.0
203     }
204 
read(&self, _buf: &mut [u8]) -> io::Result<usize>205     pub fn read(&self, _buf: &mut [u8]) -> io::Result<usize> {
206         self.0
207     }
208 
read_vectored(&self, _bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize>209     pub fn read_vectored(&self, _bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
210         self.0
211     }
212 
is_read_vectored(&self) -> bool213     pub fn is_read_vectored(&self) -> bool {
214         self.0
215     }
216 
read_buf(&self, _cursor: BorrowedCursor<'_>) -> io::Result<()>217     pub fn read_buf(&self, _cursor: BorrowedCursor<'_>) -> io::Result<()> {
218         self.0
219     }
220 
write(&self, _buf: &[u8]) -> io::Result<usize>221     pub fn write(&self, _buf: &[u8]) -> io::Result<usize> {
222         self.0
223     }
224 
write_vectored(&self, _bufs: &[IoSlice<'_>]) -> io::Result<usize>225     pub fn write_vectored(&self, _bufs: &[IoSlice<'_>]) -> io::Result<usize> {
226         self.0
227     }
228 
is_write_vectored(&self) -> bool229     pub fn is_write_vectored(&self) -> bool {
230         self.0
231     }
232 
flush(&self) -> io::Result<()>233     pub fn flush(&self) -> io::Result<()> {
234         self.0
235     }
236 
seek(&self, _pos: SeekFrom) -> io::Result<u64>237     pub fn seek(&self, _pos: SeekFrom) -> io::Result<u64> {
238         self.0
239     }
240 
duplicate(&self) -> io::Result<File>241     pub fn duplicate(&self) -> io::Result<File> {
242         self.0
243     }
244 
set_permissions(&self, _perm: FilePermissions) -> io::Result<()>245     pub fn set_permissions(&self, _perm: FilePermissions) -> io::Result<()> {
246         self.0
247     }
248 
set_times(&self, _times: FileTimes) -> io::Result<()>249     pub fn set_times(&self, _times: FileTimes) -> io::Result<()> {
250         self.0
251     }
252 }
253 
254 impl DirBuilder {
new() -> DirBuilder255     pub fn new() -> DirBuilder {
256         DirBuilder {}
257     }
258 
mkdir(&self, _p: &Path) -> io::Result<()>259     pub fn mkdir(&self, _p: &Path) -> io::Result<()> {
260         unsupported()
261     }
262 }
263 
264 impl fmt::Debug for File {
fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result265     fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
266         self.0
267     }
268 }
269 
readdir(_p: &Path) -> io::Result<ReadDir>270 pub fn readdir(_p: &Path) -> io::Result<ReadDir> {
271     unsupported()
272 }
273 
unlink(_p: &Path) -> io::Result<()>274 pub fn unlink(_p: &Path) -> io::Result<()> {
275     unsupported()
276 }
277 
rename(_old: &Path, _new: &Path) -> io::Result<()>278 pub fn rename(_old: &Path, _new: &Path) -> io::Result<()> {
279     unsupported()
280 }
281 
set_perm(_p: &Path, perm: FilePermissions) -> io::Result<()>282 pub fn set_perm(_p: &Path, perm: FilePermissions) -> io::Result<()> {
283     match perm.0 {}
284 }
285 
rmdir(_p: &Path) -> io::Result<()>286 pub fn rmdir(_p: &Path) -> io::Result<()> {
287     unsupported()
288 }
289 
remove_dir_all(_path: &Path) -> io::Result<()>290 pub fn remove_dir_all(_path: &Path) -> io::Result<()> {
291     unsupported()
292 }
293 
try_exists(_path: &Path) -> io::Result<bool>294 pub fn try_exists(_path: &Path) -> io::Result<bool> {
295     unsupported()
296 }
297 
readlink(_p: &Path) -> io::Result<PathBuf>298 pub fn readlink(_p: &Path) -> io::Result<PathBuf> {
299     unsupported()
300 }
301 
symlink(_original: &Path, _link: &Path) -> io::Result<()>302 pub fn symlink(_original: &Path, _link: &Path) -> io::Result<()> {
303     unsupported()
304 }
305 
link(_src: &Path, _dst: &Path) -> io::Result<()>306 pub fn link(_src: &Path, _dst: &Path) -> io::Result<()> {
307     unsupported()
308 }
309 
stat(_p: &Path) -> io::Result<FileAttr>310 pub fn stat(_p: &Path) -> io::Result<FileAttr> {
311     unsupported()
312 }
313 
lstat(_p: &Path) -> io::Result<FileAttr>314 pub fn lstat(_p: &Path) -> io::Result<FileAttr> {
315     unsupported()
316 }
317 
canonicalize(_p: &Path) -> io::Result<PathBuf>318 pub fn canonicalize(_p: &Path) -> io::Result<PathBuf> {
319     unsupported()
320 }
321 
copy(_from: &Path, _to: &Path) -> io::Result<u64>322 pub fn copy(_from: &Path, _to: &Path) -> io::Result<u64> {
323     unsupported()
324 }
325