summaryrefslogtreecommitdiffstats
path: root/openat/src/filetype.rs
diff options
context:
space:
mode:
Diffstat (limited to 'openat/src/filetype.rs')
-rw-r--r--openat/src/filetype.rs33
1 files changed, 0 insertions, 33 deletions
diff --git a/openat/src/filetype.rs b/openat/src/filetype.rs
deleted file mode 100644
index efaedbe..0000000
--- a/openat/src/filetype.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-use std::fs::Metadata;
-
-/// This is a simplified file type enum that is easy to match
-///
-/// It doesn't represent all the options, because that enum needs to extensible
-/// but most application do not actually need that power, so we provide
-/// this simplified enum that works for many appalications.
-#[derive(Debug, Clone, Copy, PartialEq, Eq)]
-pub enum SimpleType {
- /// Entry is a symlink
- Symlink,
- /// Entry is a directory
- Dir,
- /// Entry is a regular file
- File,
- /// Entry is neither a symlink, directory nor a regular file
- Other,
-}
-
-impl SimpleType {
- /// Find out a simple type from a file Metadata (stat)
- pub fn extract(stat: &Metadata) -> SimpleType {
- if stat.file_type().is_symlink() {
- SimpleType::Symlink
- } else if stat.is_dir() {
- SimpleType::Dir
- } else if stat.is_file() {
- SimpleType::File
- } else {
- SimpleType::Other
- }
- }
-}