pub struct FileInfo {}Expand description
Infos about a file We read and keep tracks every displayable information about a file. Like in exa we don’t display the group.
Fields§
§path: PathBufFull path of the file
filename: StringFilename
size: u64size (nb of bytes) of the file
file_size: StringFile size as a String, already human formated.
dir_symbol: charFirst symbol displaying the kind of file.
permissions: StringStr formatted permissions like rwxr..rw.
owner: StringOwner name of the file.
group: StringGroup name of the file.
system_time: StringSystem time of last modification
is_selected: boolIs this file currently selected ?
file_kind: FileKindWhat kind of file is this ?
extension: StringExtension of the file. "" for a directory.
kind_format: StringA formated filename where the “kind” of file (directory, char device, block devive, fifo, socket, normal) is prepend to the name, allowing a “sort by kind” method.
Implementations§
source§impl FileInfo
impl FileInfo
sourcepub fn new(direntry: &DirEntry, users_cache: &UsersCache) -> FmResult<FileInfo>
pub fn new(direntry: &DirEntry, users_cache: &UsersCache) -> FmResult<FileInfo>
Reads every information about a file from its metadata and returs
a new FileInfo object if we can create one.
sourcepub fn from_path_with_name(
path: &Path,
filename: &str,
users_cache: &UsersCache
) -> FmResult<Self>
pub fn from_path_with_name( path: &Path, filename: &str, users_cache: &UsersCache ) -> FmResult<Self>
Creates a fileinfo from a path and a filename. The filename is used when we create the fileinfo for “.” and “..” in every folder.
pub fn from_path(path: &Path, users_cache: &UsersCache) -> FmResult<Self>
sourcepub fn format(
&self,
owner_col_width: usize,
group_col_width: usize
) -> FmResult<String>
pub fn format( &self, owner_col_width: usize, group_col_width: usize ) -> FmResult<String>
Format the file line. Since files can have different owners in the same directory, we need to know the maximum size of owner column for formatting purpose.
pub fn format_simple(&self) -> FmResult<String>
pub fn is_dir(&self) -> bool
Trait Implementations§
source§impl SelectableContent<FileInfo> for PathContent
impl SelectableContent<FileInfo> for PathContent
Implement a selectable content for this struct.
This trait allows to navigate through a vector of element content_type.
It implements: is_empty, len, next, prev, selected.
selected returns an optional reference to the value.