pub struct DirEntry(/* private fields */);Expand description
Entries returned by the super::ReadDir stream.
An instance of DirEntry represents an entry inside of a directory on the filesystem. Each entry can be inspected via methods to learn about the full path or possibly other metadata through per-platform extension traits.
Implementations§
Source§impl DirEntry
impl DirEntry
Sourcepub fn file_name(&self) -> OsString
pub fn file_name(&self) -> OsString
Returns the file name of this entry.
This is the last component of the path, which may be a file name or a directory name.
Sourcepub async fn file_type(&self) -> Result<FileType>
pub async fn file_type(&self) -> Result<FileType>
Returns the file type for the file that this entry points at.
This function will not traverse symlinks if this entry points at a symlink.
§Platform-specific behavior
On Windows and most Unix platforms this function is free (no extra system calls needed), but some Unix platforms may require the equivalent call to symlink_metadata to learn about the target file type.
Sourcepub fn ino(&self) -> u64
Available on Unix only.
pub fn ino(&self) -> u64
Returns the underlying d_ino field in the contained dirent structure.
Sourcepub async fn metadata(&self) -> Result<Metadata>
pub async fn metadata(&self) -> Result<Metadata>
Returns the metadata for the file that this entry points at.
This function will not traverse symlinks if this entry points at a symlink.
§Platform-specific behavior
On Windows and most Unix platforms this function is free (no extra system calls needed), but some Unix platforms may require the equivalent call to symlink_metadata to learn about the target file type.