pub struct FileInfo {
pub path: PathBuf,
pub filename: String,
pub file_size: String,
pub owner: String,
pub group: String,
pub system_time: String,
pub is_selected: bool,
pub file_kind: FileKind,
pub extension: String,
pub kind_format: String,
}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
file_size: StringFile size as a String, already human formated.
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) -> Result<FileInfo>
pub fn new(direntry: &DirEntry, users_cache: &UsersCache) -> Result<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
) -> Result<Self>
pub fn from_path_with_name( path: &Path, filename: &str, users_cache: &UsersCache ) -> Result<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) -> Result<Self>
pub fn size(&self) -> Result<u64>
pub fn permissions(&self) -> Result<String>
sourcepub fn format(
&self,
owner_col_width: usize,
group_col_width: usize
) -> Result<String>
pub fn format( &self, owner_col_width: usize, group_col_width: usize ) -> Result<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 dir_symbol(&self) -> char
pub fn format_simple(&self) -> Result<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.