pub struct TreeNode<T> {
pub data: T,
pub children: Vec<TreeNode<T>>,
pub expanded: bool,
pub is_leaf: bool,
}Expand description
A node in the tree hierarchy.
Fields§
§data: TThe data for this node.
children: Vec<TreeNode<T>>Children of this node.
expanded: boolWhether this node is expanded (children visible).
is_leaf: boolWhether this node is a leaf (cannot have children).
Implementations§
Source§impl<T> TreeNode<T>
impl<T> TreeNode<T>
Sourcepub fn with_child(self, child: TreeNode<T>) -> Self
pub fn with_child(self, child: TreeNode<T>) -> Self
Add a child node.
Sourcepub fn with_children(self, children: Vec<TreeNode<T>>) -> Self
pub fn with_children(self, children: Vec<TreeNode<T>>) -> Self
Add multiple children.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for TreeNode<T>where
T: Freeze,
impl<T> RefUnwindSafe for TreeNode<T>where
T: RefUnwindSafe,
impl<T> Send for TreeNode<T>where
T: Send,
impl<T> Sync for TreeNode<T>where
T: Sync,
impl<T> Unpin for TreeNode<T>where
T: Unpin,
impl<T> UnwindSafe for TreeNode<T>where
T: UnwindSafe,
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