pub struct FileType { /* private fields */ }
Expand description
The type of a file or directory.
A file type is returned by Metadata::file_type
.
Note that file types are mutually exclusive, i.e. at most one of methods is_dir
,
is_file
, and is_symlink
can return true
.
This type is a re-export of std::fs::FileType
.
Implementations§
source§impl FileType
impl FileType
sourcepub fn is_dir(&self) -> bool
pub fn is_dir(&self) -> bool
Returns true
if this file type represents a regular directory.
If this file type represents a symbolic link, this method returns false
.
§Examples
use async_std::fs;
let file_type = fs::metadata(".").await?.file_type();
println!("{:?}", file_type.is_dir());
sourcepub fn is_file(&self) -> bool
pub fn is_file(&self) -> bool
Returns true
if this file type represents a regular file.
If this file type represents a symbolic link, this method returns false
.
§Examples
use async_std::fs;
let file_type = fs::metadata("a.txt").await?.file_type();
println!("{:?}", file_type.is_file());
sourcepub fn is_symlink(&self) -> bool
pub fn is_symlink(&self) -> bool
Returns true
if this file type represents a symbolic link.
§Examples
use async_std::fs;
let file_type = fs::metadata("a.txt").await?.file_type();
println!("{:?}", file_type.is_symlink());
Trait Implementations§
impl Copy for FileType
impl Eq for FileType
impl StructuralPartialEq for FileType
Auto Trait Implementations§
impl Freeze for FileType
impl RefUnwindSafe for FileType
impl Send for FileType
impl Sync for FileType
impl Unpin for FileType
impl UnwindSafe for FileType
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)