]>
git.proxmox.com Git - rustc.git/blob - src/libstd/sys/wasm/fs.rs
1 use crate::ffi
::OsString
;
3 use crate::hash
::{Hash, Hasher}
;
4 use crate::io
::{self, SeekFrom}
;
5 use crate::path
::{Path, PathBuf}
;
6 use crate::sys
::time
::SystemTime
;
7 use crate::sys
::{unsupported, Void}
;
11 pub struct FileAttr(Void
);
13 pub struct ReadDir(Void
);
15 pub struct DirEntry(Void
);
17 #[derive(Clone, Debug)]
18 pub struct OpenOptions { }
20 pub struct FilePermissions(Void
);
22 pub struct FileType(Void
);
25 pub struct DirBuilder { }
28 pub fn size(&self) -> u64 {
32 pub fn perm(&self) -> FilePermissions
{
36 pub fn file_type(&self) -> FileType
{
40 pub fn modified(&self) -> io
::Result
<SystemTime
> {
44 pub fn accessed(&self) -> io
::Result
<SystemTime
> {
48 pub fn created(&self) -> io
::Result
<SystemTime
> {
53 impl Clone
for FileAttr
{
54 fn clone(&self) -> FileAttr
{
59 impl FilePermissions
{
60 pub fn readonly(&self) -> bool
{
64 pub fn set_readonly(&mut self, _readonly
: bool
) {
69 impl Clone
for FilePermissions
{
70 fn clone(&self) -> FilePermissions
{
75 impl PartialEq
for FilePermissions
{
76 fn eq(&self, _other
: &FilePermissions
) -> bool
{
81 impl Eq
for FilePermissions
{
84 impl fmt
::Debug
for FilePermissions
{
85 fn fmt(&self, _f
: &mut fmt
::Formatter
<'_
>) -> fmt
::Result
{
91 pub fn is_dir(&self) -> bool
{
95 pub fn is_file(&self) -> bool
{
99 pub fn is_symlink(&self) -> bool
{
104 impl Clone
for FileType
{
105 fn clone(&self) -> FileType
{
110 impl Copy
for FileType {}
112 impl PartialEq
for FileType
{
113 fn eq(&self, _other
: &FileType
) -> bool
{
118 impl Eq
for FileType
{
121 impl Hash
for FileType
{
122 fn hash
<H
: Hasher
>(&self, _h
: &mut H
) {
127 impl fmt
::Debug
for FileType
{
128 fn fmt(&self, _f
: &mut fmt
::Formatter
<'_
>) -> fmt
::Result
{
133 impl fmt
::Debug
for ReadDir
{
134 fn fmt(&self, _f
: &mut fmt
::Formatter
<'_
>) -> fmt
::Result
{
139 impl Iterator
for ReadDir
{
140 type Item
= io
::Result
<DirEntry
>;
142 fn next(&mut self) -> Option
<io
::Result
<DirEntry
>> {
148 pub fn path(&self) -> PathBuf
{
152 pub fn file_name(&self) -> OsString
{
156 pub fn metadata(&self) -> io
::Result
<FileAttr
> {
160 pub fn file_type(&self) -> io
::Result
<FileType
> {
166 pub fn new() -> OpenOptions
{
170 pub fn read(&mut self, _read
: bool
) { }
171 pub fn write(&mut self, _write
: bool
) { }
172 pub fn append(&mut self, _append
: bool
) { }
173 pub fn truncate(&mut self, _truncate
: bool
) { }
174 pub fn create(&mut self, _create
: bool
) { }
175 pub fn create_new(&mut self, _create_new
: bool
) { }
179 pub fn open(_path
: &Path
, _opts
: &OpenOptions
) -> io
::Result
<File
> {
183 pub fn file_attr(&self) -> io
::Result
<FileAttr
> {
187 pub fn fsync(&self) -> io
::Result
<()> {
191 pub fn datasync(&self) -> io
::Result
<()> {
195 pub fn truncate(&self, _size
: u64) -> io
::Result
<()> {
199 pub fn read(&self, _buf
: &mut [u8]) -> io
::Result
<usize> {
203 pub fn write(&self, _buf
: &[u8]) -> io
::Result
<usize> {
207 pub fn flush(&self) -> io
::Result
<()> {
211 pub fn seek(&self, _pos
: SeekFrom
) -> io
::Result
<u64> {
215 pub fn duplicate(&self) -> io
::Result
<File
> {
219 pub fn set_permissions(&self, _perm
: FilePermissions
) -> io
::Result
<()> {
223 pub fn diverge(&self) -> ! {
229 pub fn new() -> DirBuilder
{
233 pub fn mkdir(&self, _p
: &Path
) -> io
::Result
<()> {
238 impl fmt
::Debug
for File
{
239 fn fmt(&self, _f
: &mut fmt
::Formatter
<'_
>) -> fmt
::Result
{
244 pub fn readdir(_p
: &Path
) -> io
::Result
<ReadDir
> {
248 pub fn unlink(_p
: &Path
) -> io
::Result
<()> {
252 pub fn rename(_old
: &Path
, _new
: &Path
) -> io
::Result
<()> {
256 pub fn set_perm(_p
: &Path
, perm
: FilePermissions
) -> io
::Result
<()> {
260 pub fn rmdir(_p
: &Path
) -> io
::Result
<()> {
264 pub fn remove_dir_all(_path
: &Path
) -> io
::Result
<()> {
268 pub fn readlink(_p
: &Path
) -> io
::Result
<PathBuf
> {
272 pub fn symlink(_src
: &Path
, _dst
: &Path
) -> io
::Result
<()> {
276 pub fn link(_src
: &Path
, _dst
: &Path
) -> io
::Result
<()> {
280 pub fn stat(_p
: &Path
) -> io
::Result
<FileAttr
> {
284 pub fn lstat(_p
: &Path
) -> io
::Result
<FileAttr
> {
288 pub fn canonicalize(_p
: &Path
) -> io
::Result
<PathBuf
> {
292 pub fn copy(_from
: &Path
, _to
: &Path
) -> io
::Result
<u64> {