#[non_exhaustive]pub enum FileKind {
Regular,
Directory,
Symlink,
Socket,
Other,
}Expand description
The kind of a file-system entry, as seen by lstat (symlinks are not
followed).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Regular
A regular file.
Directory
A directory (also used for git submodules / gitlinks).
Symlink
A symbolic link.
On Windows also a directory junction or another name-surrogate
reparse point, which the standard library reports as a symlink; see
FileKind::from_file_type.
Socket
A Unix domain socket.
Other
Anything else: FIFO, character or block device, … identify treats
these as files and opens them (which can block forever on a FIFO);
this crate tags them file without ever opening them.
Implementations§
Source§impl FileKind
impl FileKind
Sourcepub fn from_file_type(file_type: FileType) -> Self
pub fn from_file_type(file_type: FileType) -> Self
Classify a fs::FileType (from fs::symlink_metadata).
On Windows, fs::FileType::is_symlink is true for every
name-surrogate reparse point, so a directory junction is
FileKind::Symlink, while os.lstat in Python (and therefore
identify) reports a junction as a directory and only true symlinks as
links. The reparse tag that would tell them apart is not available
from the standard library without unsafe code.