Struct fm::fileinfo::PathContent

source ·
pub struct PathContent {
    pub path: PathBuf,
    pub content: Vec<FileInfo>,
    pub index: usize,
    pub show_hidden: bool,
    pub filter: FilterKind,
    /* private fields */
}
Expand description

Holds the information about file in the current directory. We know about the current path, the files themselves, the selected index, the “display all files including hidden” flag and the key to sort files.

Fields§

§path: PathBuf

The current path

§content: Vec<FileInfo>

A vector of FileInfo with every file in current path

§index: usize

The index of the selected file.

§show_hidden: bool

Do we display the hidden files ?

§filter: FilterKind

The filter use before displaying files

Implementations§

Reads the paths and creates a new PathContent. Files are sorted by filename by default. Selects the first file if any.

Apply the filter.

Convert a path to a &str. It may fails if the path contains non valid utf-8 chars.

Sort the file with current key.

Returns a vector of displayable strings for every file.

Select the file from a given index.

Reset the current file content. Reads and sort the content with current key. Select the first file if any.

Path of the currently selected file.

True if the path starts with a subpath.

Is the selected file a directory ? It may fails if the current path is empty, aka if nothing is selected.

Human readable string representation of the space used by files in current path. No recursive exploration of directory.

A string representation of the git status of the path.

Update the kind of sort from a char typed by the user.

Unselect the current item. Since we use a common trait to navigate the files, this method is required.

Select the current item. Since we use a common trait to navigate the files, this method is required.

Returns an enumeration of the files (FileInfo) in content.

Refresh the existing users.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

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.

True if the content is empty.

The size of the content.

Select the prev item.

Select the next item.

Returns a reference to the selected content.

Returns the index of the selected item.

A reference to the content.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more