File tree Expand file tree Collapse file tree 4 files changed +165
-0
lines changed Expand file tree Collapse file tree 4 files changed +165
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,48 @@ 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
+
22
64
#[ derive( Clone ) ]
23
65
pub struct FileAttr {
24
66
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,45 @@ 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
+
196
237
impl DirEntry {
197
238
pub fn path ( & self ) -> PathBuf {
198
239
self . inner . root . join ( OsStr :: from_bytes (
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ pub struct FileAttr {
20
20
size : u64 ,
21
21
}
22
22
23
+ pub struct Dir ( !) ;
24
+
23
25
pub struct ReadDir ( !) ;
24
26
25
27
pub struct DirEntry ( !) ;
@@ -115,6 +117,45 @@ impl FileType {
115
117
}
116
118
}
117
119
120
+ impl Dir {
121
+ pub fn new < P : AsRef < Path > > ( path : P ) -> io:: Result < Self > {
122
+ unsupported ( )
123
+ }
124
+
125
+ pub fn new_with < P : AsRef < Path > > ( path : P , opts : & OpenOptions ) -> io:: Result < Self > {
126
+ unsupported ( )
127
+ }
128
+
129
+ pub fn open < P : AsRef < Path > > ( & self , path : P ) -> io:: Result < File > {
130
+ self . 0
131
+ }
132
+
133
+ pub fn open_with < P : AsRef < Path > > ( & self , path : P , opts : & OpenOptions ) -> io:: Result < File > {
134
+ self . 0
135
+ }
136
+
137
+ pub fn create_dir < P : AsRef < Path > > ( & self , path : P ) -> io:: Result < ( ) > {
138
+ self . 0
139
+ }
140
+
141
+ pub fn remove_file < P : AsRef < Path > > ( & self , path : P ) -> io:: Result < ( ) > {
142
+ self . 0
143
+ }
144
+
145
+ pub fn remove_dir < P : AsRef < Path > > ( & self , path : P ) -> io:: Result < ( ) > {
146
+ self . 0
147
+ }
148
+
149
+ pub fn rename < P : AsRef < Path > , Q : AsRef < Path > > (
150
+ & self ,
151
+ from : P ,
152
+ to_dir : & Self ,
153
+ to : Q ,
154
+ ) -> io:: Result < ( ) > {
155
+ self . 0
156
+ }
157
+ }
158
+
118
159
impl fmt:: Debug for ReadDir {
119
160
fn fmt ( & self , _f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
120
161
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,45 @@ 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
+
163
204
impl ReadDir {
164
205
fn new ( dir : File , root : PathBuf ) -> ReadDir {
165
206
ReadDir {
You can’t perform that action at this time.
0 commit comments