feat(tvix/eval/io): impl From<std::fs::FileType> for FileType
Change-Id: If92ddaf3b469c4635c234b193f8d7716e11887f6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12630 Tested-by: BuildkiteCI Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com> Autosubmit: flokli <flokli@flokli.de>
This commit is contained in:
parent
a833703dab
commit
da9a6e5b78
1 changed files with 14 additions and 0 deletions
|
@ -48,6 +48,20 @@ impl std::fmt::Display for FileType {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<std::fs::FileType> for FileType {
|
||||
fn from(value: std::fs::FileType) -> Self {
|
||||
if value.is_file() {
|
||||
Self::Regular
|
||||
} else if value.is_dir() {
|
||||
Self::Directory
|
||||
} else if value.is_symlink() {
|
||||
Self::Symlink
|
||||
} else {
|
||||
Self::Unknown
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents all possible filesystem interactions that exist in the Nix
|
||||
/// language, and that need to be executed somehow.
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue