Struct broot::tree::Tree

source ·
pub struct Tree {
    pub lines: Box<[TreeLine]>,
    pub selection: usize,
    pub options: TreeOptions,
    pub scroll: usize,
    pub total_search: bool,
    pub git_status: ComputationResult<TreeGitStatus>,
    pub build_report: BuildReport,
}
Expand description

The tree which may be displayed, with onle line per visible line of the panel.

In the tree structure, every “node” is just a line, there’s no link from a child to its parent or from a parent to its children.

Fields§

§lines: Box<[TreeLine]>§selection: usize§options: TreeOptions§scroll: usize§total_search: bool§git_status: ComputationResult<TreeGitStatus>§build_report: BuildReport

Implementations§

source§

impl Tree

source

pub fn refresh(
&mut self,
page_height: usize,
con: &AppContext
) -> Result<(), TreeBuildError>

rebuild the tree with the same root, height, and options

source

pub fn after_lines_changed(&mut self)

do what must be done after line additions or removals:

  • sort the lines
  • compute left branches
source

pub fn is_empty(&self) -> bool

source

pub fn has_branch(&self, line_index: usize, depth: usize) -> bool

source

pub fn move_selection(&mut self, dy: i32, page_height: usize, cycle: bool)

select another line

For example the following one if dy is 1.

source

pub fn try_scroll(&mut self, dy: i32, page_height: usize) -> bool

Scroll the desired amount and return true, or return false if it’s already at end or the tree fits the page

source

pub fn try_select_y(&mut self, y: usize) -> bool

try to select a line by index of visible line (works if y+scroll falls on a selectable line)

source

pub fn make_selection_visible(&mut self, page_height: usize)

source

pub fn selected_line(&self) -> &TreeLine

source

pub fn root(&self) -> &PathBuf

source

pub fn try_select_best_match(&mut self)

select the line with the best matching score

source

pub fn try_select_path(&mut self, path: &Path) -> bool

return true when we could select the given path

source

pub fn try_select_first(&mut self) -> bool

source

pub fn try_select_last(&mut self, page_height: usize) -> bool

source

pub fn try_select_previous_same_depth(&mut self, page_height: usize) -> bool

source

pub fn try_select_next_same_depth(&mut self, page_height: usize) -> bool

source

pub fn try_select_previous_filtered<F>(
&mut self,
filter: F,
page_height: usize
) -> boolwhere
F: Fn(&TreeLine) -> bool,

source

pub fn try_select_next_filtered<F>(
&mut self,
filter: F,
page_height: usize
) -> boolwhere
F: Fn(&TreeLine) -> bool,

source

pub fn has_dir_missing_sum(&self) -> bool

source

pub fn is_missing_git_status_computation(&self) -> bool

source

pub fn fetch_regular_file_sums(&mut self)

fetch the file_sums of regular files (thus avoiding the long computation which is needed for directories)

source

pub fn fetch_some_missing_dir_sum(&mut self, dam: &Dam, con: &AppContext)

compute the file_sum of one directory

To compute the size of all of them, this should be called until has_dir_missing_sum returns false

source

pub fn total_sum(&self) -> FileSum

compute and return the size of the root

Trait Implementations§

source§

impl Clone for Tree

source§

fn clone(&self) -> Tree

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Tree

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Tree

§

impl Send for Tree

§

impl Sync for Tree

§

impl Unpin for Tree

§

impl UnwindSafe for Tree

Blanket Implementations§

source§

impl<T> Any for Twhere
T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere
T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere
U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.