Skip to content

Commit d4a9a2b

Browse files
committed
add unsupported implementations for missing platforms
1 parent f4d6ffc commit d4a9a2b

File tree

4 files changed

+165
-0
lines changed

4 files changed

+165
-0
lines changed

library/std/src/sys/fs/hermit.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,48 @@ use crate::{fmt, mem};
1919

2020
#[derive(Debug)]
2121
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+
2264
#[derive(Clone)]
2365
pub struct FileAttr {
2466
stat_val: stat_struct,

library/std/src/sys/fs/solid.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ pub struct FileType(c_short);
8585
#[derive(Debug)]
8686
pub struct DirBuilder {}
8787

88+
pub struct Dir(!);
89+
8890
impl FileAttr {
8991
pub fn size(&self) -> u64 {
9092
self.stat.st_size as u64
@@ -193,6 +195,45 @@ 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+
196237
impl DirEntry {
197238
pub fn path(&self) -> PathBuf {
198239
self.inner.root.join(OsStr::from_bytes(

library/std/src/sys/fs/uefi.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ pub struct FileAttr {
2020
size: u64,
2121
}
2222

23+
pub struct Dir(!);
24+
2325
pub struct ReadDir(!);
2426

2527
pub struct DirEntry(!);
@@ -115,6 +117,45 @@ impl FileType {
115117
}
116118
}
117119

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+
118159
impl fmt::Debug for ReadDir {
119160
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
120161
self.0

library/std/src/sys/fs/wasi.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ pub struct FileAttr {
2424
meta: wasi::Filestat,
2525
}
2626

27+
pub struct Dir(!);
28+
2729
pub struct ReadDir {
2830
inner: Arc<ReadDirInner>,
2931
state: ReadDirState,
@@ -160,6 +162,45 @@ 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+
163204
impl ReadDir {
164205
fn new(dir: File, root: PathBuf) -> ReadDir {
165206
ReadDir {

0 commit comments

Comments
 (0)