pub struct TreeNode { /* private fields */ }Expand description
A node in the tree.
Implementations§
Source§impl TreeNode
impl TreeNode
Sourcepub fn new(label: impl Into<Text>) -> Self
pub fn new(label: impl Into<Text>) -> Self
Create a new tree node with a label.
Passing a &str uses Text::new() and does NOT parse markup.
For styled labels, pass a pre-styled Text (e.g. from
crate::markup::render_or_plain).
Sourcepub fn with_icon(icon: impl Into<String>, label: impl Into<Text>) -> Self
pub fn with_icon(icon: impl Into<String>, label: impl Into<Text>) -> Self
Create a new tree node with an icon and label.
Passing a &str uses Text::new() and does NOT parse markup.
For styled labels, pass a pre-styled Text (e.g. from
crate::markup::render_or_plain).
Sourcepub fn children(self, nodes: impl IntoIterator<Item = TreeNode>) -> Self
pub fn children(self, nodes: impl IntoIterator<Item = TreeNode>) -> Self
Add multiple child nodes.
Sourcepub fn icon_style(self, style: Style) -> Self
pub fn icon_style(self, style: Style) -> Self
Set the icon style.
Sourcepub fn children_nodes(&self) -> &[TreeNode]
pub fn children_nodes(&self) -> &[TreeNode]
Get the children.
Sourcepub fn has_children(&self) -> bool
pub fn has_children(&self) -> bool
Check if this node has children.
Sourcepub fn is_expanded(&self) -> bool
pub fn is_expanded(&self) -> bool
Check if this node is expanded.
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 UnsafeUnpin 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