]>
git.proxmox.com Git - rustc.git/blob - src/libstd/sys/cloudabi/shims/fs.rs
1 // Copyright 2017 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 {}
93 impl fmt
::Debug
for FilePermissions
{
94 fn fmt(&self, _f
: &mut fmt
::Formatter
) -> fmt
::Result
{
100 pub fn is_dir(&self) -> bool
{
104 pub fn is_file(&self) -> bool
{
108 pub fn is_symlink(&self) -> bool
{
113 impl Clone
for FileType
{
114 fn clone(&self) -> FileType
{
119 impl Copy
for FileType {}
121 impl PartialEq
for FileType
{
122 fn eq(&self, _other
: &FileType
) -> bool
{
127 impl Eq
for FileType {}
129 impl Hash
for FileType
{
130 fn hash
<H
: Hasher
>(&self, _h
: &mut H
) {
135 impl fmt
::Debug
for FileType
{
136 fn fmt(&self, _f
: &mut fmt
::Formatter
) -> fmt
::Result
{
141 impl fmt
::Debug
for ReadDir
{
142 fn fmt(&self, _f
: &mut fmt
::Formatter
) -> fmt
::Result
{
147 impl Iterator
for ReadDir
{
148 type Item
= io
::Result
<DirEntry
>;
150 fn next(&mut self) -> Option
<io
::Result
<DirEntry
>> {
156 pub fn path(&self) -> PathBuf
{
160 pub fn file_name(&self) -> OsString
{
164 pub fn metadata(&self) -> io
::Result
<FileAttr
> {
168 pub fn file_type(&self) -> io
::Result
<FileType
> {
174 pub fn new() -> OpenOptions
{
178 pub fn read(&mut self, _read
: bool
) {}
179 pub fn write(&mut self, _write
: bool
) {}
180 pub fn append(&mut self, _append
: bool
) {}
181 pub fn truncate(&mut self, _truncate
: bool
) {}
182 pub fn create(&mut self, _create
: bool
) {}
183 pub fn create_new(&mut self, _create_new
: bool
) {}
187 pub fn open(_path
: &Path
, _opts
: &OpenOptions
) -> io
::Result
<File
> {
191 pub fn file_attr(&self) -> io
::Result
<FileAttr
> {
195 pub fn fsync(&self) -> io
::Result
<()> {
199 pub fn datasync(&self) -> io
::Result
<()> {
203 pub fn truncate(&self, _size
: u64) -> io
::Result
<()> {
207 pub fn read(&self, _buf
: &mut [u8]) -> io
::Result
<usize> {
211 pub fn write(&self, _buf
: &[u8]) -> io
::Result
<usize> {
215 pub fn flush(&self) -> io
::Result
<()> {
219 pub fn seek(&self, _pos
: SeekFrom
) -> io
::Result
<u64> {
223 pub fn duplicate(&self) -> io
::Result
<File
> {
227 pub fn set_permissions(&self, _perm
: FilePermissions
) -> io
::Result
<()> {
231 pub fn diverge(&self) -> ! {
237 pub fn new() -> DirBuilder
{
241 pub fn mkdir(&self, _p
: &Path
) -> io
::Result
<()> {
246 impl fmt
::Debug
for File
{
247 fn fmt(&self, _f
: &mut fmt
::Formatter
) -> fmt
::Result
{
252 pub fn readdir(_p
: &Path
) -> io
::Result
<ReadDir
> {
256 pub fn unlink(_p
: &Path
) -> io
::Result
<()> {
260 pub fn rename(_old
: &Path
, _new
: &Path
) -> io
::Result
<()> {
264 pub fn set_perm(_p
: &Path
, perm
: FilePermissions
) -> io
::Result
<()> {
268 pub fn rmdir(_p
: &Path
) -> io
::Result
<()> {
272 pub fn remove_dir_all(_path
: &Path
) -> io
::Result
<()> {
276 pub fn readlink(_p
: &Path
) -> io
::Result
<PathBuf
> {
280 pub fn symlink(_src
: &Path
, _dst
: &Path
) -> io
::Result
<()> {
284 pub fn link(_src
: &Path
, _dst
: &Path
) -> io
::Result
<()> {
288 pub fn stat(_p
: &Path
) -> io
::Result
<FileAttr
> {
292 pub fn lstat(_p
: &Path
) -> io
::Result
<FileAttr
> {
296 pub fn canonicalize(_p
: &Path
) -> io
::Result
<PathBuf
> {
300 pub fn copy(_from
: &Path
, _to
: &Path
) -> io
::Result
<u64> {