pub struct TreeNode {
pub children: IndexMap<String, Self>,
pub is_leaf: bool,
}Expand description
A structure representing a node in a tree.
This structure is used to represent a node in a tree. Each node has a collection
of children, which are also nodes. The IndexMap ensures that the children are
ordered in the order they were inserted.
§Fields
children- AnIndexMapwhere the keys areStringand the values areTreeNode. This represents the children of the node.is_leaf- A boolean flag that indicates whether the node is a leaf node (i.e., it has no children).
Fields§
§children: IndexMap<String, Self>The children of this node.
is_leaf: boolWhether this node is a leaf (has no children).
Implementations§
Source§impl TreeNode
impl TreeNode
Sourcepub fn add_path<I>(&mut self, parts: I)
pub fn add_path<I>(&mut self, parts: I)
Adds a path to the tree structure.
The path is split into parts, and each part is added as a node in the tree. If a part already exists, it is reused.
§Type Parameters
I- An iterator over string-like items that can be referenced as strings.
§Arguments
parts- An iterable of path components to add to the tree.
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