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};
1919
2020#[ derive( Debug ) ]
2121pub 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+
2270#[ derive( Clone ) ]
2371pub struct FileAttr {
2472 stat_val : stat_struct ,
Original file line number Diff line number Diff line change @@ -85,6 +85,8 @@ pub struct FileType(c_short);
8585#[ derive( Debug ) ]
8686pub struct DirBuilder { }
8787
88+ pub struct Dir ( !) ;
89+
8890impl FileAttr {
8991 pub fn size ( & self ) -> u64 {
9092 self . stat . st_size as u64
@@ -193,6 +195,51 @@ impl Drop for InnerReadDir {
193195 }
194196}
195197
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+
196243impl DirEntry {
197244 pub fn path ( & self ) -> PathBuf {
198245 self . inner . root . join ( OsStr :: from_bytes (
Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ pub struct FileAttr {
2020 size : u64 ,
2121}
2222
23+ #[ derive( Debug ) ]
24+ pub struct Dir ( !) ;
25+
2326pub struct ReadDir ( !) ;
2427
2528pub struct DirEntry ( !) ;
@@ -115,6 +118,51 @@ impl FileType {
115118 }
116119}
117120
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+
118166impl fmt:: Debug for ReadDir {
119167 fn fmt ( & self , _f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
120168 self . 0
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ pub struct FileAttr(!);
1313
1414pub struct ReadDir ( !) ;
1515
16+ pub struct Dir ( !) ;
17+
1618pub struct DirEntry ( !) ;
1719
1820#[ derive( Clone , Debug ) ]
@@ -151,6 +153,51 @@ impl Iterator for ReadDir {
151153 }
152154}
153155
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+
154201impl DirEntry {
155202 pub fn path ( & self ) -> PathBuf {
156203 self . 0
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ pub struct FileAttr {
2424 meta : wasi:: Filestat ,
2525}
2626
27+ pub struct Dir ( !) ;
28+
2729pub struct ReadDir {
2830 inner : Arc < ReadDirInner > ,
2931 state : ReadDirState ,
@@ -160,6 +162,51 @@ impl FileType {
160162 }
161163}
162164
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+
163210impl ReadDir {
164211 fn new ( dir : File , root : PathBuf ) -> ReadDir {
165212 ReadDir {
You can’t perform that action at this time.
0 commit comments