1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
13 use hash::{Hash, Hasher};
14 use io::{self, SeekFrom};
15 use path::{Path, PathBuf};
16 use sys::time::SystemTime;
17 use sys::{unsupported, Void};
19 pub struct File(Void);
21 pub struct FileAttr(Void);
23 pub struct ReadDir(Void);
25 pub struct DirEntry(Void);
27 #[derive(Clone, Debug)]
28 pub struct OpenOptions { }
30 pub struct FilePermissions(Void);
32 pub struct FileType(Void);
35 pub struct DirBuilder { }
38 pub fn size(&self) -> u64 {
42 pub fn perm(&self) -> FilePermissions {
46 pub fn file_type(&self) -> FileType {
50 pub fn modified(&self) -> io::Result<SystemTime> {
54 pub fn accessed(&self) -> io::Result<SystemTime> {
58 pub fn created(&self) -> io::Result<SystemTime> {
63 impl Clone for FileAttr {
64 fn clone(&self) -> FileAttr {
69 impl FilePermissions {
70 pub fn readonly(&self) -> bool {
74 pub fn set_readonly(&mut self, _readonly: bool) {
79 impl Clone for FilePermissions {
80 fn clone(&self) -> FilePermissions {
85 impl PartialEq for FilePermissions {
86 fn eq(&self, _other: &FilePermissions) -> bool {
91 impl Eq for FilePermissions {
94 impl fmt::Debug for FilePermissions {
95 fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
101 pub fn is_dir(&self) -> bool {
105 pub fn is_file(&self) -> bool {
109 pub fn is_symlink(&self) -> bool {
114 impl Clone for FileType {
115 fn clone(&self) -> FileType {
120 impl Copy for FileType {}
122 impl PartialEq for FileType {
123 fn eq(&self, _other: &FileType) -> bool {
128 impl Eq for FileType {
131 impl Hash for FileType {
132 fn hash<H: Hasher>(&self, _h: &mut H) {
137 impl fmt::Debug for FileType {
138 fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
143 impl fmt::Debug for ReadDir {
144 fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
149 impl Iterator for ReadDir {
150 type Item = io::Result<DirEntry>;
152 fn next(&mut self) -> Option<io::Result<DirEntry>> {
158 pub fn path(&self) -> PathBuf {
162 pub fn file_name(&self) -> OsString {
166 pub fn metadata(&self) -> io::Result<FileAttr> {
170 pub fn file_type(&self) -> io::Result<FileType> {
176 pub fn new() -> OpenOptions {
180 pub fn read(&mut self, _read: bool) { }
181 pub fn write(&mut self, _write: bool) { }
182 pub fn append(&mut self, _append: bool) { }
183 pub fn truncate(&mut self, _truncate: bool) { }
184 pub fn create(&mut self, _create: bool) { }
185 pub fn create_new(&mut self, _create_new: bool) { }
189 pub fn open(_path: &Path, _opts: &OpenOptions) -> io::Result<File> {
193 pub fn file_attr(&self) -> io::Result<FileAttr> {
197 pub fn fsync(&self) -> io::Result<()> {
201 pub fn datasync(&self) -> io::Result<()> {
205 pub fn truncate(&self, _size: u64) -> io::Result<()> {
209 pub fn read(&self, _buf: &mut [u8]) -> io::Result<usize> {
213 pub fn write(&self, _buf: &[u8]) -> io::Result<usize> {
217 pub fn flush(&self) -> io::Result<()> {
221 pub fn seek(&self, _pos: SeekFrom) -> io::Result<u64> {
225 pub fn duplicate(&self) -> io::Result<File> {
229 pub fn set_permissions(&self, _perm: FilePermissions) -> io::Result<()> {
233 pub fn diverge(&self) -> ! {
239 pub fn new() -> DirBuilder {
243 pub fn mkdir(&self, _p: &Path) -> io::Result<()> {
248 impl fmt::Debug for File {
249 fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
254 pub fn readdir(_p: &Path) -> io::Result<ReadDir> {
258 pub fn unlink(_p: &Path) -> io::Result<()> {
262 pub fn rename(_old: &Path, _new: &Path) -> io::Result<()> {
266 pub fn set_perm(_p: &Path, perm: FilePermissions) -> io::Result<()> {
270 pub fn rmdir(_p: &Path) -> io::Result<()> {
274 pub fn remove_dir_all(_path: &Path) -> io::Result<()> {
278 pub fn readlink(_p: &Path) -> io::Result<PathBuf> {
282 pub fn symlink(_src: &Path, _dst: &Path) -> io::Result<()> {
286 pub fn link(_src: &Path, _dst: &Path) -> io::Result<()> {
290 pub fn stat(_p: &Path) -> io::Result<FileAttr> {
294 pub fn lstat(_p: &Path) -> io::Result<FileAttr> {
298 pub fn canonicalize(_p: &Path) -> io::Result<PathBuf> {
302 pub fn copy(_from: &Path, _to: &Path) -> io::Result<u64> {