Move DirEntry::ino method to an extension trait

Fixes #46
This commit is contained in:
Ashley Mannix 2017-08-04 08:27:26 +10:00 committed by Andrew Gallant
parent 107750f24e
commit 9d55d29fcb

View File

@ -962,13 +962,6 @@ impl DirEntry {
self.depth
}
/// Returns the underlying `d_ino` field in the contained `dirent`
/// structure.
#[cfg(unix)]
pub fn ino(&self) -> u64 {
self.ino
}
#[cfg(not(unix))]
fn from_entry(depth: usize, ent: &fs::DirEntry) -> Result<DirEntry> {
let ty = try!(ent.file_type().map_err(|err| {
@ -1028,6 +1021,15 @@ 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 {