From c4af8e617302063c2f33e9709dcd99c4f0819b6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Lawson?= Date: Fri, 4 Aug 2017 08:30:16 +1000 Subject: Use doc from std::os::unix::fs::DirEntryExt for trait walkdir::unix::DirEntryExt. Moved trait implementation for DirEntry in module unix. --- src/lib.rs | 10 +--------- src/unix.rs | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 src/unix.rs 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>`]. @@ -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 + } +} -- cgit v1.2.3