pub trait DirEntry {
type Path: ?Sized;
type PathOwned;
type Metadata;
type FileType;
type Error;
// Required methods
fn path(&self) -> Self::PathOwned;
fn metadata(&self) -> Result<Self::Metadata, Self::Error>;
fn file_type(&self) -> Result<Self::FileType, Self::Error>;
fn file_name(&self) -> &Self::Path;
}
Expand description
Entries returned by the Dir
iterator.
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.
Required Associated Types§
Required Methods§
Sourcefn path(&self) -> Self::PathOwned
fn path(&self) -> Self::PathOwned
Returns the full path to the file that this entry represents.
The full path is created by joining the original path to read_dir
with the filename of this entry.
Sourcefn metadata(&self) -> Result<Self::Metadata, Self::Error>
fn metadata(&self) -> Result<Self::Metadata, Self::Error>
Return the metadata for the file that this entry points at.
This function will not traverse symlinks if this entry points at a symlink.