File tree Expand file tree Collapse file tree 5 files changed +237
-0
lines changed Expand file tree Collapse file tree 5 files changed +237
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,54 @@ use crate::{fmt, mem};
19
19
20
20
#[ derive( Debug ) ]
21
21
pub struct File ( FileDesc ) ;
22
+
23
+ pub struct Dir ( !) ;
24
+
25
+ impl Dir {
26
+ pub fn new < P : AsRef < Path > > ( _path : P ) -> io:: Result < Self > {
27
+ unsupported ( )
28
+ }
29
+
30
+ pub fn new_with < P : AsRef < Path > > ( _path : P , opts : & OpenOptions ) -> io:: Result < Self > {
31
+ unsupported ( )
32
+ }
33
+
34
+ pub fn open < P : AsRef < Path > > ( & self , _path : P ) -> io:: Result < File > {
35
+ self . 0
36
+ }
37
+
38
+ pub fn open_with < P : AsRef < Path > > ( & self , _path : P , opts : & OpenOptions ) -> io:: Result < File > {
39
+ self . 0
40
+ }
41
+
42
+ pub fn create_dir < P : AsRef < Path > > ( & self , _path : P ) -> io:: Result < ( ) > {
43
+ self . 0
44
+ }
45
+
46
+ pub fn remove_file < P : AsRef < Path > > ( & self , _path : P ) -> io:: Result < ( ) > {
47
+ self . 0
48
+ }
49
+
50
+ pub fn remove_dir < P : AsRef < Path > > ( & self , _path : P ) -> io:: Result < ( ) > {
51
+ self . 0
52
+ }
53
+
54
+ pub fn rename < P : AsRef < Path > , Q : AsRef < Path > > (
55
+ & self ,
56
+ _from : P ,
57
+ _to_dir : & Self ,
58
+ _to : Q ,
59
+ ) -> io:: Result < ( ) > {
60
+ self . 0
61
+ }
62
+ }
63
+
64
+ impl fmt:: Debug for Dir {
65
+ fn fmt ( & self , _f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
66
+ self . 0
67
+ }
68
+ }
69
+
22
70
#[ derive( Clone ) ]
23
71
pub struct FileAttr {
24
72
stat_val : stat_struct ,
Original file line number Diff line number Diff line change @@ -85,6 +85,8 @@ pub struct FileType(c_short);
85
85
#[ derive( Debug ) ]
86
86
pub struct DirBuilder { }
87
87
88
+ pub struct Dir ( !) ;
89
+
88
90
impl FileAttr {
89
91
pub fn size ( & self ) -> u64 {
90
92
self . stat . st_size as u64
@@ -193,6 +195,51 @@ impl Drop for InnerReadDir {
193
195
}
194
196
}
195
197
198
+ impl Dir {
199
+ pub fn new < P : AsRef < Path > > ( _path : P ) -> io:: Result < Self > {
200
+ unsupported ( )
201
+ }
202
+
203
+ pub fn new_with < P : AsRef < Path > > ( _path : P , opts : & OpenOptions ) -> io:: Result < Self > {
204
+ unsupported ( )
205
+ }
206
+
207
+ pub fn open < P : AsRef < Path > > ( & self , _path : P ) -> io:: Result < File > {
208
+ self . 0
209
+ }
210
+
211
+ pub fn open_with < P : AsRef < Path > > ( & self , _path : P , opts : & OpenOptions ) -> io:: Result < File > {
212
+ self . 0
213
+ }
214
+
215
+ pub fn create_dir < P : AsRef < Path > > ( & self , _path : P ) -> io:: Result < ( ) > {
216
+ self . 0
217
+ }
218
+
219
+ pub fn remove_file < P : AsRef < Path > > ( & self , _path : P ) -> io:: Result < ( ) > {
220
+ self . 0
221
+ }
222
+
223
+ pub fn remove_dir < P : AsRef < Path > > ( & self , _path : P ) -> io:: Result < ( ) > {
224
+ self . 0
225
+ }
226
+
227
+ pub fn rename < P : AsRef < Path > , Q : AsRef < Path > > (
228
+ & self ,
229
+ _from : P ,
230
+ _to_dir : & Self ,
231
+ _to : Q ,
232
+ ) -> io:: Result < ( ) > {
233
+ self . 0
234
+ }
235
+ }
236
+
237
+ impl fmt:: Debug for Dir {
238
+ fn fmt ( & self , _f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
239
+ self . 0
240
+ }
241
+ }
242
+
196
243
impl DirEntry {
197
244
pub fn path ( & self ) -> PathBuf {
198
245
self . inner . root . join ( OsStr :: from_bytes (
Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ pub struct FileAttr {
20
20
size : u64 ,
21
21
}
22
22
23
+ #[ derive( Debug ) ]
24
+ pub struct Dir ( !) ;
25
+
23
26
pub struct ReadDir ( !) ;
24
27
25
28
pub struct DirEntry ( !) ;
@@ -115,6 +118,51 @@ impl FileType {
115
118
}
116
119
}
117
120
121
+ impl Dir {
122
+ pub fn new < P : AsRef < Path > > ( _path : P ) -> io:: Result < Self > {
123
+ unsupported ( )
124
+ }
125
+
126
+ pub fn new_with < P : AsRef < Path > > ( _path : P , opts : & OpenOptions ) -> io:: Result < Self > {
127
+ unsupported ( )
128
+ }
129
+
130
+ pub fn open < P : AsRef < Path > > ( & self , _path : P ) -> io:: Result < File > {
131
+ self . 0
132
+ }
133
+
134
+ pub fn open_with < P : AsRef < Path > > ( & self , _path : P , opts : & OpenOptions ) -> io:: Result < File > {
135
+ self . 0
136
+ }
137
+
138
+ pub fn create_dir < P : AsRef < Path > > ( & self , _path : P ) -> io:: Result < ( ) > {
139
+ self . 0
140
+ }
141
+
142
+ pub fn remove_file < P : AsRef < Path > > ( & self , _path : P ) -> io:: Result < ( ) > {
143
+ self . 0
144
+ }
145
+
146
+ pub fn remove_dir < P : AsRef < Path > > ( & self , _path : P ) -> io:: Result < ( ) > {
147
+ self . 0
148
+ }
149
+
150
+ pub fn rename < P : AsRef < Path > , Q : AsRef < Path > > (
151
+ & self ,
152
+ _from : P ,
153
+ _to_dir : & Self ,
154
+ _to : Q ,
155
+ ) -> io:: Result < ( ) > {
156
+ self . 0
157
+ }
158
+ }
159
+
160
+ impl fmt:: Debug for Dir {
161
+ fn fmt ( & self , _f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
162
+ self . 0
163
+ }
164
+ }
165
+
118
166
impl fmt:: Debug for ReadDir {
119
167
fn fmt ( & self , _f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
120
168
self . 0
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ pub struct FileAttr(!);
13
13
14
14
pub struct ReadDir ( !) ;
15
15
16
+ pub struct Dir ( !) ;
17
+
16
18
pub struct DirEntry ( !) ;
17
19
18
20
#[ derive( Clone , Debug ) ]
@@ -151,6 +153,51 @@ impl Iterator for ReadDir {
151
153
}
152
154
}
153
155
156
+ impl Dir {
157
+ pub fn new < P : AsRef < Path > > ( _path : P ) -> io:: Result < Self > {
158
+ unsupported ( )
159
+ }
160
+
161
+ pub fn new_with < P : AsRef < Path > > ( _path : P , opts : & OpenOptions ) -> io:: Result < Self > {
162
+ unsupported ( )
163
+ }
164
+
165
+ pub fn open < P : AsRef < Path > > ( & self , _path : P ) -> io:: Result < File > {
166
+ self . 0
167
+ }
168
+
169
+ pub fn open_with < P : AsRef < Path > > ( & self , _path : P , opts : & OpenOptions ) -> io:: Result < File > {
170
+ self . 0
171
+ }
172
+
173
+ pub fn create_dir < P : AsRef < Path > > ( & self , _path : P ) -> io:: Result < ( ) > {
174
+ self . 0
175
+ }
176
+
177
+ pub fn remove_file < P : AsRef < Path > > ( & self , _path : P ) -> io:: Result < ( ) > {
178
+ self . 0
179
+ }
180
+
181
+ pub fn remove_dir < P : AsRef < Path > > ( & self , _path : P ) -> io:: Result < ( ) > {
182
+ self . 0
183
+ }
184
+
185
+ pub fn rename < P : AsRef < Path > , Q : AsRef < Path > > (
186
+ & self ,
187
+ _from : P ,
188
+ _to_dir : & Self ,
189
+ _to : Q ,
190
+ ) -> io:: Result < ( ) > {
191
+ self . 0
192
+ }
193
+ }
194
+
195
+ impl fmt:: Debug for Dir {
196
+ fn fmt ( & self , _f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
197
+ self . 0
198
+ }
199
+ }
200
+
154
201
impl DirEntry {
155
202
pub fn path ( & self ) -> PathBuf {
156
203
self . 0
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ pub struct FileAttr {
24
24
meta : wasi:: Filestat ,
25
25
}
26
26
27
+ pub struct Dir ( !) ;
28
+
27
29
pub struct ReadDir {
28
30
inner : Arc < ReadDirInner > ,
29
31
state : ReadDirState ,
@@ -160,6 +162,51 @@ impl FileType {
160
162
}
161
163
}
162
164
165
+ impl Dir {
166
+ pub fn new < P : AsRef < Path > > ( _path : P ) -> io:: Result < Self > {
167
+ unsupported ( )
168
+ }
169
+
170
+ pub fn new_with < P : AsRef < Path > > ( _path : P , opts : & OpenOptions ) -> io:: Result < Self > {
171
+ unsupported ( )
172
+ }
173
+
174
+ pub fn open < P : AsRef < Path > > ( & self , _path : P ) -> io:: Result < File > {
175
+ self . 0
176
+ }
177
+
178
+ pub fn open_with < P : AsRef < Path > > ( & self , _path : P , opts : & OpenOptions ) -> io:: Result < File > {
179
+ self . 0
180
+ }
181
+
182
+ pub fn create_dir < P : AsRef < Path > > ( & self , _path : P ) -> io:: Result < ( ) > {
183
+ self . 0
184
+ }
185
+
186
+ pub fn remove_file < P : AsRef < Path > > ( & self , _path : P ) -> io:: Result < ( ) > {
187
+ self . 0
188
+ }
189
+
190
+ pub fn remove_dir < P : AsRef < Path > > ( & self , _path : P ) -> io:: Result < ( ) > {
191
+ self . 0
192
+ }
193
+
194
+ pub fn rename < P : AsRef < Path > , Q : AsRef < Path > > (
195
+ & self ,
196
+ _from : P ,
197
+ _to_dir : & Self ,
198
+ _to : Q ,
199
+ ) -> io:: Result < ( ) > {
200
+ self . 0
201
+ }
202
+ }
203
+
204
+ impl fmt:: Debug for Dir {
205
+ fn fmt ( & self , _f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
206
+ self . 0
207
+ }
208
+ }
209
+
163
210
impl ReadDir {
164
211
fn new ( dir : File , root : PathBuf ) -> ReadDir {
165
212
ReadDir {
You can’t perform that action at this time.
0 commit comments