Skip to main content

Tree

Struct Tree 

Source
pub struct Tree {
    pub root: PathBuf,
    pub entries: Vec<Entry>,
    pub hidden: bool,
}

Fields§

§root: PathBuf§entries: Vec<Entry>§hidden: bool

Implementations§

Source§

impl Tree

Source

pub fn new(root: PathBuf, hidden: bool) -> Self

Source

pub fn display_root(&self) -> Cow<'_, str>

root, or — on the synthetic drives level — a label for it, since an empty path would otherwise render as a blank title bar.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn get(&self, i: usize) -> Option<&Entry>

Source

pub fn reload(&mut self)

Source

pub fn toggle(&mut self, i: usize)

Expand or collapse the directory at i. No-op on files.

Source

pub fn parent_of(&self, i: usize) -> Option<usize>

Index of the entry that i is nested under.

Source

pub fn up(&mut self) -> bool

Re-root one directory up. At a drive root on Windows, steps out to the synthetic drives level ([load]) instead of stopping, since C:\ has no parent the way nested directories do. False once there is truly nothing above (the drives level itself, or / on other platforms).

Auto Trait Implementations§

§

impl Freeze for Tree

§

impl RefUnwindSafe for Tree

§

impl Send for Tree

§

impl Sync for Tree

§

impl Unpin for Tree

§

impl UnsafeUnpin for Tree

§

impl UnwindSafe for Tree

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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.

Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.