Created
October 13, 2014 15:54
-
-
Save adamreid/9cbc5b3575ba73e75aa2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io; | |
use std::io::{fs, FileType}; | |
fn main() { | |
match fs::stat(&Path::new(".")) { | |
Ok(stat) => println!("{}", ft_display_str(&stat.kind)), | |
Err(e) => println!("Could not stat .: {}", e), | |
}; | |
} | |
fn ft_display_str(ft: &FileType) -> &'static str { | |
match ft { | |
TypeFile => "regular file", | |
TypeDirectory => "directory", | |
TypeNamedPipe => "fifo", | |
TypeBlockSpecial => "block special file", | |
TypeSymlink => "symbolic link", | |
TypeUnknown => "unknown", | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main.rs:14:9: 14:22 error: unreachable pattern [E0001] (pass `--explain E0001` to see a detailed explanation) | |
main.rs:14 TypeDirectory => "directory", | |
^~~~~~~~~~~~~ | |
main.rs:15:9: 15:22 error: unreachable pattern [E0001] (pass `--explain E0001` to see a detailed explanation) | |
main.rs:15 TypeNamedPipe => "fifo", | |
^~~~~~~~~~~~~ | |
main.rs:16:9: 16:25 error: unreachable pattern [E0001] (pass `--explain E0001` to see a detailed explanation) | |
main.rs:16 TypeBlockSpecial => "block special file", | |
^~~~~~~~~~~~~~~~ | |
main.rs:17:9: 17:20 error: unreachable pattern [E0001] (pass `--explain E0001` to see a detailed explanation) | |
main.rs:17 TypeSymlink => "symbolic link", | |
^~~~~~~~~~~ | |
main.rs:18:9: 18:20 error: unreachable pattern [E0001] (pass `--explain E0001` to see a detailed explanation) | |
main.rs:18 TypeUnknown => "unknown", | |
^~~~~~~~~~~ | |
error: aborting due to 5 previous errors |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment