pub struct TreeNode {
pub name: String,
pub path: PathBuf,
pub is_dir: bool,
pub git_status: FileGitStatus,
pub depth: usize,
pub children: Vec<TreeNode>,
}Expand description
A node in the file tree
Fields§
§name: StringFile or directory name
path: PathBufFull path from repository root
is_dir: boolIs this a directory?
git_status: FileGitStatusGit status (for files)
depth: usizeDepth in tree (for indentation)
children: Vec<TreeNode>Children (for directories)
Implementations§
Source§impl TreeNode
impl TreeNode
Sourcepub fn file(
name: impl Into<String>,
path: impl Into<PathBuf>,
depth: usize,
) -> Self
pub fn file( name: impl Into<String>, path: impl Into<PathBuf>, depth: usize, ) -> Self
Create a new file node
Sourcepub fn dir(
name: impl Into<String>,
path: impl Into<PathBuf>,
depth: usize,
) -> Self
pub fn dir( name: impl Into<String>, path: impl Into<PathBuf>, depth: usize, ) -> Self
Create a new directory node
Sourcepub fn with_status(self, status: FileGitStatus) -> Self
pub fn with_status(self, status: FileGitStatus) -> Self
Set git status
Sourcepub fn sort_children(&mut self)
pub fn sort_children(&mut self)
Sort children (directories first, then alphabetically)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TreeNode
impl RefUnwindSafe for TreeNode
impl Send for TreeNode
impl Sync for TreeNode
impl Unpin for TreeNode
impl UnwindSafe for TreeNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more