unsupported.rs - source
Description: Source of the Rust file `library/std/src/sys/fs/unsupported.rs`.

#
std/sys/fs/
unsupported.rs

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