diff options
-rw-r--r-- | src/lib.rs | 10 | ||||
-rw-r--r-- | src/unix.rs | 15 |
2 files changed, 16 insertions, 9 deletions
@@ -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 + } +} |