pub struct Directory {
pub content: Vec<(String, ColoredString)>,
pub tree: Tree,
pub selected_index: usize,
/* private fields */
}Expand description
Display a tree view of a directory. The “tree view” is calculated recursively. It may take some time if the directory has a lot of children.
Fields§
§content: Vec<(String, ColoredString)>§tree: Tree§selected_index: usizeImplementations§
source§impl Directory
impl Directory
sourcepub fn new(
path: &Path,
users_cache: &UsersCache,
colors: &Colors,
filter_kind: &FilterKind,
show_hidden: bool,
max_depth: Option<usize>
) -> FmResult<Self>
pub fn new( path: &Path, users_cache: &UsersCache, colors: &Colors, filter_kind: &FilterKind, show_hidden: bool, max_depth: Option<usize> ) -> FmResult<Self>
Creates a new tree view of the directory. We only hold the result here, since the tree itself has now usage atm.
sourcepub fn empty(path: &Path, users_cache: &UsersCache) -> FmResult<Self>
pub fn empty(path: &Path, users_cache: &UsersCache) -> FmResult<Self>
Creates an empty directory preview.
sourcepub fn select_root(&mut self, colors: &Colors) -> FmResult<()>
pub fn select_root(&mut self, colors: &Colors) -> FmResult<()>
Select the root node and reset the view.
sourcepub fn unselect_children(&mut self)
pub fn unselect_children(&mut self)
Unselect every child node.
sourcepub fn select_next(&mut self, colors: &Colors) -> FmResult<()>
pub fn select_next(&mut self, colors: &Colors) -> FmResult<()>
Select the “next” element of the tree if any. This is the element immediatly below the current one.
sourcepub fn select_prev(&mut self, colors: &Colors) -> FmResult<()>
pub fn select_prev(&mut self, colors: &Colors) -> FmResult<()>
Select the previous sibling if any. This is the element immediatly below the current one.
sourcepub fn update_tree_position_from_index(
&mut self,
colors: &Colors
) -> FmResult<()>
pub fn update_tree_position_from_index( &mut self, colors: &Colors ) -> FmResult<()>
Update the position of the selected element from its index.
sourcepub fn select_first_child(&mut self, colors: &Colors) -> FmResult<()>
pub fn select_first_child(&mut self, colors: &Colors) -> FmResult<()>
Select the first child, if any.
sourcepub fn select_parent(&mut self, colors: &Colors) -> FmResult<()>
pub fn select_parent(&mut self, colors: &Colors) -> FmResult<()>
Select the parent of current node.
sourcepub fn go_to_bottom_leaf(&mut self, colors: &Colors) -> FmResult<()>
pub fn go_to_bottom_leaf(&mut self, colors: &Colors) -> FmResult<()>
Select the last leaf of the tree (ie the last line.)
sourcepub fn make_preview(&mut self, colors: &Colors)
pub fn make_preview(&mut self, colors: &Colors)
Make a preview of the tree.