Trait rsfs::FileType
[−]
[src]
pub trait FileType: Copy + Clone + PartialEq + Eq + Hash + Debug { fn is_dir(&self) -> bool; fn is_file(&self) -> bool; fn is_symlink(&self) -> bool; }
Returned from Metadata::file_type
, this trait represents the type of a file.
Required Methods
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);
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);
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 GenFS
s
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);