|
| 1 | +use crate::ffi::OsString; |
| 2 | +use crate::fmt; |
| 3 | +use crate::hash::{Hash, Hasher}; |
| 4 | +use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut, SeekFrom}; |
| 5 | +use crate::path::{Path, PathBuf}; |
| 6 | +use crate::sys::time::SystemTime; |
| 7 | +use crate::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 { |
| 31 | + pub fn size(&self) -> u64 { |
| 32 | + self.0 |
| 33 | + } |
| 34 | + |
| 35 | + pub fn perm(&self) -> FilePermissions { |
| 36 | + self.0 |
| 37 | + } |
| 38 | + |
| 39 | + pub fn file_type(&self) -> FileType { |
| 40 | + self.0 |
| 41 | + } |
| 42 | + |
| 43 | + pub fn modified(&self) -> io::Result<SystemTime> { |
| 44 | + self.0 |
| 45 | + } |
| 46 | + |
| 47 | + pub fn accessed(&self) -> io::Result<SystemTime> { |
| 48 | + self.0 |
| 49 | + } |
| 50 | + |
| 51 | + pub fn created(&self) -> io::Result<SystemTime> { |
| 52 | + self.0 |
| 53 | + } |
| 54 | +} |
| 55 | + |
| 56 | +impl Clone for FileAttr { |
| 57 | + fn clone(&self) -> FileAttr { |
| 58 | + self.0 |
| 59 | + } |
| 60 | +} |
| 61 | + |
| 62 | +impl FilePermissions { |
| 63 | + pub fn readonly(&self) -> bool { |
| 64 | + self.0 |
| 65 | + } |
| 66 | + |
| 67 | + pub fn set_readonly(&mut self, _readonly: bool) { |
| 68 | + self.0 |
| 69 | + } |
| 70 | +} |
| 71 | + |
| 72 | +impl Clone for FilePermissions { |
| 73 | + fn clone(&self) -> FilePermissions { |
| 74 | + self.0 |
| 75 | + } |
| 76 | +} |
| 77 | + |
| 78 | +impl PartialEq for FilePermissions { |
| 79 | + fn eq(&self, _other: &FilePermissions) -> bool { |
| 80 | + self.0 |
| 81 | + } |
| 82 | +} |
| 83 | + |
| 84 | +impl Eq for FilePermissions {} |
| 85 | + |
| 86 | +impl fmt::Debug for FilePermissions { |
| 87 | + fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 88 | + self.0 |
| 89 | + } |
| 90 | +} |
| 91 | + |
| 92 | +impl FileTimes { |
| 93 | + pub fn set_accessed(&mut self, _t: SystemTime) {} |
| 94 | + pub fn set_modified(&mut self, _t: SystemTime) {} |
| 95 | +} |
| 96 | + |
| 97 | +impl FileType { |
| 98 | + pub fn is_dir(&self) -> bool { |
| 99 | + self.0 |
| 100 | + } |
| 101 | + |
| 102 | + pub fn is_file(&self) -> bool { |
| 103 | + self.0 |
| 104 | + } |
| 105 | + |
| 106 | + pub fn is_symlink(&self) -> bool { |
| 107 | + self.0 |
| 108 | + } |
| 109 | +} |
| 110 | + |
| 111 | +impl Clone for FileType { |
| 112 | + fn clone(&self) -> FileType { |
| 113 | + self.0 |
| 114 | + } |
| 115 | +} |
| 116 | + |
| 117 | +impl Copy for FileType {} |
| 118 | + |
| 119 | +impl PartialEq for FileType { |
| 120 | + fn eq(&self, _other: &FileType) -> bool { |
| 121 | + self.0 |
| 122 | + } |
| 123 | +} |
| 124 | + |
| 125 | +impl Eq for FileType {} |
| 126 | + |
| 127 | +impl Hash for FileType { |
| 128 | + fn hash<H: Hasher>(&self, _h: &mut H) { |
| 129 | + self.0 |
| 130 | + } |
| 131 | +} |
| 132 | + |
| 133 | +impl fmt::Debug for FileType { |
| 134 | + fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 135 | + self.0 |
| 136 | + } |
| 137 | +} |
| 138 | + |
| 139 | +impl fmt::Debug for ReadDir { |
| 140 | + 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 | + |
| 148 | + fn next(&mut self) -> Option<io::Result<DirEntry>> { |
| 149 | + self.0 |
| 150 | + } |
| 151 | +} |
| 152 | + |
| 153 | +impl DirEntry { |
| 154 | + pub fn path(&self) -> PathBuf { |
| 155 | + self.0 |
| 156 | + } |
| 157 | + |
| 158 | + pub fn file_name(&self) -> OsString { |
| 159 | + self.0 |
| 160 | + } |
| 161 | + |
| 162 | + pub fn metadata(&self) -> io::Result<FileAttr> { |
| 163 | + self.0 |
| 164 | + } |
| 165 | + |
| 166 | + pub fn file_type(&self) -> io::Result<FileType> { |
| 167 | + self.0 |
| 168 | + } |
| 169 | +} |
| 170 | + |
| 171 | +impl OpenOptions { |
| 172 | + pub fn new() -> OpenOptions { |
| 173 | + OpenOptions {} |
| 174 | + } |
| 175 | + |
| 176 | + pub fn read(&mut self, _read: bool) {} |
| 177 | + pub fn write(&mut self, _write: bool) {} |
| 178 | + pub fn append(&mut self, _append: bool) {} |
| 179 | + pub fn truncate(&mut self, _truncate: bool) {} |
| 180 | + pub fn create(&mut self, _create: bool) {} |
| 181 | + pub fn create_new(&mut self, _create_new: bool) {} |
| 182 | +} |
| 183 | + |
| 184 | +impl File { |
| 185 | + pub fn open(_path: &Path, _opts: &OpenOptions) -> io::Result<File> { |
| 186 | + unsupported() |
| 187 | + } |
| 188 | + |
| 189 | + pub fn file_attr(&self) -> io::Result<FileAttr> { |
| 190 | + self.0 |
| 191 | + } |
| 192 | + |
| 193 | + pub fn fsync(&self) -> io::Result<()> { |
| 194 | + self.0 |
| 195 | + } |
| 196 | + |
| 197 | + pub fn datasync(&self) -> io::Result<()> { |
| 198 | + self.0 |
| 199 | + } |
| 200 | + |
| 201 | + pub fn lock(&self) -> io::Result<()> { |
| 202 | + self.0 |
| 203 | + } |
| 204 | + |
| 205 | + pub fn lock_shared(&self) -> io::Result<()> { |
| 206 | + self.0 |
| 207 | + } |
| 208 | + |
| 209 | + pub fn try_lock(&self) -> io::Result<bool> { |
| 210 | + self.0 |
| 211 | + } |
| 212 | + |
| 213 | + pub fn try_lock_shared(&self) -> io::Result<bool> { |
| 214 | + self.0 |
| 215 | + } |
| 216 | + |
| 217 | + pub fn unlock(&self) -> io::Result<()> { |
| 218 | + self.0 |
| 219 | + } |
| 220 | + |
| 221 | + pub fn truncate(&self, _size: u64) -> io::Result<()> { |
| 222 | + self.0 |
| 223 | + } |
| 224 | + |
| 225 | + pub fn read(&self, _buf: &mut [u8]) -> io::Result<usize> { |
| 226 | + self.0 |
| 227 | + } |
| 228 | + |
| 229 | + pub fn read_vectored(&self, _bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> { |
| 230 | + self.0 |
| 231 | + } |
| 232 | + |
| 233 | + pub fn is_read_vectored(&self) -> bool { |
| 234 | + self.0 |
| 235 | + } |
| 236 | + |
| 237 | + pub fn read_buf(&self, _cursor: BorrowedCursor<'_>) -> io::Result<()> { |
| 238 | + self.0 |
| 239 | + } |
| 240 | + |
| 241 | + pub fn write(&self, _buf: &[u8]) -> io::Result<usize> { |
| 242 | + self.0 |
| 243 | + } |
| 244 | + |
| 245 | + pub fn write_vectored(&self, _bufs: &[IoSlice<'_>]) -> io::Result<usize> { |
| 246 | + self.0 |
| 247 | + } |
| 248 | + |
| 249 | + pub fn is_write_vectored(&self) -> bool { |
| 250 | + self.0 |
| 251 | + } |
| 252 | + |
| 253 | + pub fn flush(&self) -> io::Result<()> { |
| 254 | + self.0 |
| 255 | + } |
| 256 | + |
| 257 | + pub fn seek(&self, _pos: SeekFrom) -> io::Result<u64> { |
| 258 | + self.0 |
| 259 | + } |
| 260 | + |
| 261 | + pub fn duplicate(&self) -> io::Result<File> { |
| 262 | + self.0 |
| 263 | + } |
| 264 | + |
| 265 | + pub fn set_permissions(&self, _perm: FilePermissions) -> io::Result<()> { |
| 266 | + self.0 |
| 267 | + } |
| 268 | + |
| 269 | + pub fn set_times(&self, _times: FileTimes) -> io::Result<()> { |
| 270 | + self.0 |
| 271 | + } |
| 272 | +} |
| 273 | + |
| 274 | +impl DirBuilder { |
| 275 | + pub fn new() -> DirBuilder { |
| 276 | + DirBuilder {} |
| 277 | + } |
| 278 | + |
| 279 | + pub fn mkdir(&self, _p: &Path) -> io::Result<()> { |
| 280 | + unsupported() |
| 281 | + } |
| 282 | +} |
| 283 | + |
| 284 | +impl fmt::Debug for File { |
| 285 | + fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 286 | + self.0 |
| 287 | + } |
| 288 | +} |
| 289 | + |
| 290 | +pub fn readdir(_p: &Path) -> io::Result<ReadDir> { |
| 291 | + unsupported() |
| 292 | +} |
| 293 | + |
| 294 | +pub fn unlink(_p: &Path) -> io::Result<()> { |
| 295 | + unsupported() |
| 296 | +} |
| 297 | + |
| 298 | +pub fn rename(_old: &Path, _new: &Path) -> io::Result<()> { |
| 299 | + unsupported() |
| 300 | +} |
| 301 | + |
| 302 | +pub fn set_perm(_p: &Path, perm: FilePermissions) -> io::Result<()> { |
| 303 | + match perm.0 {} |
| 304 | +} |
| 305 | + |
| 306 | +pub fn rmdir(_p: &Path) -> io::Result<()> { |
| 307 | + unsupported() |
| 308 | +} |
| 309 | + |
| 310 | +pub fn remove_dir_all(_path: &Path) -> io::Result<()> { |
| 311 | + unsupported() |
| 312 | +} |
| 313 | + |
| 314 | +pub fn exists(_path: &Path) -> io::Result<bool> { |
| 315 | + unsupported() |
| 316 | +} |
| 317 | + |
| 318 | +pub fn readlink(_p: &Path) -> io::Result<PathBuf> { |
| 319 | + unsupported() |
| 320 | +} |
| 321 | + |
| 322 | +pub fn symlink(_original: &Path, _link: &Path) -> io::Result<()> { |
| 323 | + unsupported() |
| 324 | +} |
| 325 | + |
| 326 | +pub fn link(_src: &Path, _dst: &Path) -> io::Result<()> { |
| 327 | + unsupported() |
| 328 | +} |
| 329 | + |
| 330 | +pub fn stat(_p: &Path) -> io::Result<FileAttr> { |
| 331 | + unsupported() |
| 332 | +} |
| 333 | + |
| 334 | +pub fn lstat(_p: &Path) -> io::Result<FileAttr> { |
| 335 | + unsupported() |
| 336 | +} |
| 337 | + |
| 338 | +pub fn canonicalize(_p: &Path) -> io::Result<PathBuf> { |
| 339 | + unsupported() |
| 340 | +} |
| 341 | + |
| 342 | +pub fn copy(_from: &Path, _to: &Path) -> io::Result<u64> { |
| 343 | + unsupported() |
| 344 | +} |
0 commit comments