pub struct FileEntry {
pub path: PathBuf,
pub name: String,
pub is_dir: bool,
pub is_hidden: bool,
pub size: u64,
pub modified: Option<SystemTime>,
pub is_symlink: bool,
pub is_readonly: bool,
}Expand description
A file entry with cached metadata
Fields§
§path: PathBufFull path to the file
name: StringFile name (cached for sorting, lossy UTF-8)
is_dir: boolIs this a directory?
Is this a hidden file?
size: u64File size in bytes (0 for directories)
modified: Option<SystemTime>Last modified time
is_symlink: boolIs this a symbolic link? (from DirEntry::file_type)
is_readonly: boolIs this file readonly? (from metadata.permissions)
Implementations§
Source§impl FileEntry
impl FileEntry
Sourcepub fn new(
path: PathBuf,
is_dir: bool,
size: u64,
modified: Option<SystemTime>,
is_symlink: bool,
is_readonly: bool,
) -> Self
pub fn new( path: PathBuf, is_dir: bool, size: u64, modified: Option<SystemTime>, is_symlink: bool, is_readonly: bool, ) -> Self
Create a new file entry from a path and metadata
Sourcepub fn parent_entry(parent_path: PathBuf) -> Self
pub fn parent_entry(parent_path: PathBuf) -> Self
Create a parent directory entry (“..”)
This is used to display and navigate to the parent directory in file browsers. The path should be the actual parent path.
Sourcepub fn is_parent_entry(&self) -> bool
pub fn is_parent_entry(&self) -> bool
Check if this is a parent directory entry (“..”)
Sourcepub fn resolve_symlink(&self) -> Option<PathBuf>
pub fn resolve_symlink(&self) -> Option<PathBuf>
Resolve symlink target. Returns None if not a symlink or broken/loop. Cost: One read_link syscall. Cache result if called repeatedly.
Sourcepub fn is_executable(&self) -> bool
pub fn is_executable(&self) -> bool
Check if file is executable. Cost: Unix: stat() for mode bits. Windows: extension check (cheap).
Sourcepub fn is_symlink_broken(&self) -> bool
pub fn is_symlink_broken(&self) -> bool
Detect broken symlink (target doesn’t exist). Cost: One stat() on target path.
Sourcepub fn is_symlink_loop(&self) -> bool
pub fn is_symlink_loop(&self) -> bool
Detect symlink loop (circular reference). Cost: Path canonicalization.
Sourcepub fn category(&self) -> FileCategory
pub fn category(&self) -> FileCategory
Get the file category for UI icons and grouping.
Resolution order:
- If symlink → Symlink
- If directory → Directory
- If executable (Unix: +x, Windows: exe/bat/etc) → Executable
- Otherwise → based on extension
Cost: May call is_executable() which does a stat() on Unix.
Trait Implementations§
impl Eq for FileEntry
Auto Trait Implementations§
impl Freeze for FileEntry
impl RefUnwindSafe for FileEntry
impl Send for FileEntry
impl Sync for FileEntry
impl Unpin for FileEntry
impl UnwindSafe for FileEntry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.