Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/walkdir.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib.rs10
-rw-r--r--src/unix.rs15
2 files changed, 16 insertions, 9 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 6ed71aa..0d700cc 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -132,6 +132,7 @@ use std::vec;
use same_file::is_same_file;
+#[cfg(unix)] mod unix;
#[cfg(test)] mod tests;
/// Like try, but for iterators that return [`Option<Result<_, _>>`].
@@ -1021,15 +1022,6 @@ impl DirEntry {
}
}
-#[cfg(unix)]
-impl std::os::unix::fs::DirEntryExt for DirEntry {
- /// Returns the underlying `d_ino` field in the contained `dirent`
- /// structure.
- fn ino(&self) -> u64 {
- self.ino
- }
-}
-
impl Clone for DirEntry {
#[cfg(not(unix))]
fn clone(&self) -> DirEntry {
diff --git a/src/unix.rs b/src/unix.rs
new file mode 100644
index 0000000..c8f495f
--- /dev/null
+++ b/src/unix.rs
@@ -0,0 +1,15 @@
+use DirEntry;
+
+/// Unix-specific extension methods for `walkdir::DirEntry`
+pub trait DirEntryExt {
+ /// Returns the underlying `d_ino` field in the contained `dirent` structure.
+ fn ino(&self) -> u64;
+}
+
+impl DirEntryExt for DirEntry {
+ /// Returns the underlying `d_ino` field in the contained `dirent`
+ /// structure.
+ fn ino(&self) -> u64 {
+ self.ino
+ }
+}