diff options
author | Jérémie Lawson <jeremielate@gmail.com> | 2017-08-04 01:30:16 +0300 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2017-08-04 01:52:10 +0300 |
commit | c4af8e617302063c2f33e9709dcd99c4f0819b6f (patch) | |
tree | a69ac90a1a71c73655f9c6ecead057ac516cb65d | |
parent | 9d55d29fcb71f95cdba74eb05aac94aadc70fe57 (diff) |
Use doc from std::os::unix::fs::DirEntryExt for trait walkdir::unix::DirEntryExt.
Moved trait implementation for DirEntry in module unix.
-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 + } +} |