use crate::{
fs::{FileType, Metadata},
fs_utf8::to_utf8,
};
use std::io;
pub struct DirEntry<'dir> {
cap_std: crate::fs::DirEntry<'dir>,
}
impl<'dir> DirEntry<'dir> {
#[inline]
pub fn from_cap_std(cap_std: crate::fs::DirEntry<'dir>) -> Self {
Self { cap_std }
}
#[inline]
pub fn metadata(&self) -> io::Result<Metadata> {
self.cap_std.metadata()
}
#[inline]
pub fn file_type(&self) -> io::Result<FileType> {
self.cap_std.file_type()
}
#[inline]
pub fn file_name(&self) -> String {
to_utf8(self.cap_std.file_name()).unwrap()
}
}
#[cfg(unix)]
impl<'dir> std::os::unix::fs::DirEntryExt for DirEntry<'dir> {
fn ino(&self) -> u64 {
self.cap_std.ino()
}
}