1 use crate::ffi::OsString;
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;
11 pub struct FileAttr(!);
13 pub struct ReadDir(!);
15 pub struct DirEntry(!);
17 #[derive(Clone, Debug)]
18 pub struct OpenOptions {}
20 #[derive(Copy, Clone, Debug, Default)]
21 pub struct FileTimes {}
23 pub struct FilePermissions(!);
25 pub struct FileType(!);
28 pub struct DirBuilder {}
31 pub fn size(&self) -> u64 {
35 pub fn perm(&self) -> FilePermissions {
39 pub fn file_type(&self) -> FileType {
43 pub fn modified(&self) -> io::Result<SystemTime> {
47 pub fn accessed(&self) -> io::Result<SystemTime> {
51 pub fn created(&self) -> io::Result<SystemTime> {
56 impl Clone for FileAttr {
57 fn clone(&self) -> FileAttr {
62 impl FilePermissions {
63 pub fn readonly(&self) -> bool {
67 pub fn set_readonly(&mut self, _readonly: bool) {
72 impl Clone for FilePermissions {
73 fn clone(&self) -> FilePermissions {
78 impl PartialEq for FilePermissions {
79 fn eq(&self, _other: &FilePermissions) -> bool {
84 impl Eq for FilePermissions {}
86 impl fmt::Debug for FilePermissions {
87 fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
93 pub fn set_accessed(&mut self, _t: SystemTime) {}
94 pub fn set_modified(&mut self, _t: SystemTime) {}
98 pub fn is_dir(&self) -> bool {
102 pub fn is_file(&self) -> bool {
106 pub fn is_symlink(&self) -> bool {
111 impl Clone for FileType {
112 fn clone(&self) -> FileType {
117 impl Copy for FileType {}
119 impl PartialEq for FileType {
120 fn eq(&self, _other: &FileType) -> bool {
125 impl Eq for FileType {}
127 impl Hash for FileType {
128 fn hash<H: Hasher>(&self, _h: &mut H) {
133 impl fmt::Debug for FileType {
134 fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
139 impl fmt::Debug for ReadDir {
140 fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
145 impl Iterator for ReadDir {
146 type Item = io::Result<DirEntry>;
148 fn next(&mut self) -> Option<io::Result<DirEntry>> {
154 pub fn path(&self) -> PathBuf {
158 pub fn file_name(&self) -> OsString {
162 pub fn metadata(&self) -> io::Result<FileAttr> {
166 pub fn file_type(&self) -> io::Result<FileType> {
172 pub fn new() -> OpenOptions {
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) {}
185 pub fn open(_path: &Path, _opts: &OpenOptions) -> io::Result<File> {
189 pub fn file_attr(&self) -> io::Result<FileAttr> {
193 pub fn fsync(&self) -> io::Result<()> {
197 pub fn datasync(&self) -> io::Result<()> {
201 pub fn truncate(&self, _size: u64) -> io::Result<()> {
205 pub fn read(&self, _buf: &mut [u8]) -> io::Result<usize> {
209 pub fn read_vectored(&self, _bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
213 pub fn is_read_vectored(&self) -> bool {
217 pub fn read_buf(&self, _cursor: BorrowedCursor<'_>) -> io::Result<()> {
221 pub fn write(&self, _buf: &[u8]) -> io::Result<usize> {
225 pub fn write_vectored(&self, _bufs: &[IoSlice<'_>]) -> io::Result<usize> {
229 pub fn is_write_vectored(&self) -> bool {
233 pub fn flush(&self) -> io::Result<()> {
237 pub fn seek(&self, _pos: SeekFrom) -> io::Result<u64> {
241 pub fn duplicate(&self) -> io::Result<File> {
245 pub fn set_permissions(&self, _perm: FilePermissions) -> io::Result<()> {
249 pub fn set_times(&self, _times: FileTimes) -> io::Result<()> {
255 pub fn new() -> DirBuilder {
259 pub fn mkdir(&self, _p: &Path) -> io::Result<()> {
264 impl fmt::Debug for File {
265 fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
270 pub fn readdir(_p: &Path) -> io::Result<ReadDir> {
274 pub fn unlink(_p: &Path) -> io::Result<()> {
278 pub fn rename(_old: &Path, _new: &Path) -> io::Result<()> {
282 pub fn set_perm(_p: &Path, perm: FilePermissions) -> io::Result<()> {
286 pub fn rmdir(_p: &Path) -> io::Result<()> {
290 pub fn remove_dir_all(_path: &Path) -> io::Result<()> {
294 pub fn try_exists(_path: &Path) -> io::Result<bool> {
298 pub fn readlink(_p: &Path) -> io::Result<PathBuf> {
302 pub fn symlink(_original: &Path, _link: &Path) -> io::Result<()> {
306 pub fn link(_src: &Path, _dst: &Path) -> io::Result<()> {
310 pub fn stat(_p: &Path) -> io::Result<FileAttr> {
314 pub fn lstat(_p: &Path) -> io::Result<FileAttr> {
318 pub fn canonicalize(_p: &Path) -> io::Result<PathBuf> {
322 pub fn copy(_from: &Path, _to: &Path) -> io::Result<u64> {