pub enum TreeNode {
Regular,
Directory(Vec<FsTree>),
Symlink(PathBuf),
}
Expand description
A filesystem tree recursive enum.
This enum has a variant for the following file types:
TreeNode::Regular
- A regular file.TreeNode::Directory
- A folder with a (possible empty) list of children.TreeNode::Symlink
- A symbolic link that points to another path.
Variants§
Regular
A regular file.
Directory(Vec<FsTree>)
A directory, might have children FsTree
s inside.
Symlink(PathBuf)
Symbolic link, and it’s target path.
The link might be broken, it’s not guaranteed that a symlink points to a valid path.
Implementations§
source§impl TreeNode
impl TreeNode
sourcepub fn is_same_type_as(&self, other: &Self) -> bool
pub fn is_same_type_as(&self, other: &Self) -> bool
Checks if the TreeNode is the same type as other.
sourcepub fn is_regular(&self) -> bool
pub fn is_regular(&self) -> bool
Shorthand for file.file_type.is_regular()
sourcepub fn is_symlink(&self) -> bool
pub fn is_symlink(&self) -> bool
Shorthand for file.file_type.is_symlink()
sourcepub fn file_type_display(&self) -> &'static str
pub fn file_type_display(&self) -> &'static str
Displays the file type discriminant str.
Trait Implementations§
source§impl Ord for TreeNode
impl Ord for TreeNode
source§impl PartialEq<TreeNode> for TreeNode
impl PartialEq<TreeNode> for TreeNode
source§impl PartialOrd<TreeNode> for TreeNode
impl PartialOrd<TreeNode> for TreeNode
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for TreeNode
impl StructuralEq for TreeNode
impl StructuralPartialEq for TreeNode
Auto Trait Implementations§
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