pub trait FileType:
Copy
+ Clone
+ PartialEq
+ Eq
+ Hash
+ Debug {
// Required methods
fn is_dir(&self) -> bool;
fn is_file(&self) -> bool;
fn is_symlink(&self) -> bool;
}Expand description
Returned from Metadata::file_type, this trait represents the type of a file.
Required Methods§
Sourcefn is_dir(&self) -> bool
fn is_dir(&self) -> bool
Returns whether this file type is a directory.
§Examples
use rsfs::*;
use rsfs::mem::FS;
let fs = FS::new();
let metadata = fs.metadata("foo.txt")?;
let file_type = metadata.file_type();
assert_eq!(file_type.is_dir(), false);Sourcefn is_file(&self) -> bool
fn is_file(&self) -> bool
Returns whether this file type is a file.
§Examples
use rsfs::*;
use rsfs::mem::FS;
let fs = FS::new();
let metadata = fs.metadata("foo.txt")?;
let file_type = metadata.file_type();
assert_eq!(file_type.is_file(), true);Sourcefn is_symlink(&self) -> bool
fn is_symlink(&self) -> bool
Returns whether this file type is a symlink.
This will only ever be true if the underlying Metadata type is retrieved with GenFSs
symlink_metadata method.
§Examples
use rsfs::*;
use rsfs::mem::FS;
let fs = FS::new();
let metadata = fs.metadata("foo.txt")?;
let file_type = metadata.file_type();
assert_eq!(file_type.is_symlink(), false);Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.