std.fs.FileType
Valuetype pub copy enum FileType
A type describing the type of file, such as a file or directory.
Constructors
File
File()
The file is a file.
Directory
Directory()
The file is a directory.
SymbolicLink
SymbolicLink()
The file is a symbolic link.
Other
Other()
The file is something else that isn't explicitly covered by this type.
Instance methods
!=
Show source codeHide source code
fn pub !=(other: T) -> Bool {
(self == other).false?
}
fn pub !=(other: T) -> Bool
Returns true
if self
and the given object are not equal to each other.
==
Show source codeHide source code
fn pub ==(other: ref FileType) -> Bool {
match (self, other) {
case (File, File) -> true
case (Directory, Directory) -> true
case (SymbolicLink, SymbolicLink) -> true
case (Other, Other) -> true
case _ -> false
}
}
fn pub ==(other: FileType) -> Bool
Returns true
if self
and the given object are equal to each other.
This operator is used to perform structural equality. This means two objects residing in different memory locations may be considered equal, provided their structure is equal. For example, two different arrays may be considered to have structural equality if they contain the exact same values.
directory?
Show source codeHide source code
fn pub directory? -> Bool {
match self {
case Directory -> true
case _ -> false
}
}
fn pub directory? -> Bool
Returns true
if self
is a directory.
file?
Show source codeHide source code
fn pub file? -> Bool {
match self {
case File -> true
case _ -> false
}
}
fn pub file? -> Bool
Returns true
if self
is a file.
fmt
Show source codeHide source code
fn pub fmt(formatter: mut Formatter) {
let name = match self {
case File -> 'File'
case Directory -> 'Directory'
case SymbolicLink -> 'SymbolicLink'
case Other -> 'Other'
}
formatter.tuple(name).finish
}
fn pub fmt(formatter: mut Formatter)
Formats self
in a human-readable format for debugging purposes.
symbolic_link?
Show source codeHide source code
fn pub symbolic_link? -> Bool {
match self {
case SymbolicLink -> true
case _ -> false
}
}
fn pub symbolic_link? -> Bool
Returns true
if self
is a symbolic link.
Implemented traits
Equal
impl Equal[FileType] for FileType
Format
impl Format for FileType