We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
io_err
1 parent ad6b9b6 commit 3f6ee52Copy full SHA for 3f6ee52
gix-fs/src/lib.rs
@@ -83,6 +83,18 @@ pub fn is_executable(metadata: &std::fs::Metadata) -> bool {
83
(metadata.mode() & 0o100) != 0
84
}
85
86
+/// Classifiers for IO-errors.
87
+pub mod io_err {
88
+ use std::io::ErrorKind;
89
+
90
+ /// Return `true` if `err` indicates that the entry doesn't exist on disk. `raw` is used as well
91
+ /// for additional checks while the variants are outside the MSRV.
92
+ pub fn is_not_found(err: ErrorKind, raw_err: Option<i32>) -> bool {
93
+ // TODO: use variant once MSRV is 1.83
94
+ err == ErrorKind::NotFound || raw_err == Some(20)
95
+ }
96
+}
97
98
#[cfg(not(unix))]
99
/// Returns whether a a file has the executable permission set.
100
pub fn is_executable(_metadata: &std::fs::Metadata) -> bool {
0 commit comments