pub struct TreeNodeOptions {
pub style: Option<Style>,
pub guide_style: Option<Style>,
pub expanded: Option<bool>,
pub highlight: Option<bool>,
}Expand description
A tree node that can be rendered with guide lines.
Tree is a hierarchical data structure where each node has a label (content) and zero or more children. When rendered, guide lines connect the nodes to show the tree structure.
§Example
ⓘ
use rich_rs::{Tree, Text};
let mut root = Tree::new(Box::new(Text::plain("Documents")));
let mut projects = root.add(Box::new(Text::plain("Projects")));
projects.add(Box::new(Text::plain("project1")));
projects.add(Box::new(Text::plain("project2")));
root.add(Box::new(Text::plain("notes.txt")));Options for adding a child node to a tree.
Used with Tree::add_with_options() to specify per-node overrides.
Fields§
§style: Option<Style>Style for this node’s label. If None, inherits from parent.
guide_style: Option<Style>Style for guide lines from this node. If None, inherits from parent.
expanded: Option<bool>Whether children are shown. Defaults to true.
highlight: Option<bool>Whether to apply highlighting. If None, inherits from parent.
Implementations§
Source§impl TreeNodeOptions
impl TreeNodeOptions
Sourcepub fn with_style(self, style: Style) -> Self
pub fn with_style(self, style: Style) -> Self
Set the node style.
Sourcepub fn with_guide_style(self, style: Style) -> Self
pub fn with_guide_style(self, style: Style) -> Self
Set the guide style.
Sourcepub fn with_expanded(self, expanded: bool) -> Self
pub fn with_expanded(self, expanded: bool) -> Self
Set whether children are expanded.
Sourcepub fn with_highlight(self, highlight: bool) -> Self
pub fn with_highlight(self, highlight: bool) -> Self
Set whether to highlight.
Trait Implementations§
Source§impl Clone for TreeNodeOptions
impl Clone for TreeNodeOptions
Source§fn clone(&self) -> TreeNodeOptions
fn clone(&self) -> TreeNodeOptions
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TreeNodeOptions
impl Debug for TreeNodeOptions
Source§impl Default for TreeNodeOptions
impl Default for TreeNodeOptions
Source§fn default() -> TreeNodeOptions
fn default() -> TreeNodeOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TreeNodeOptions
impl RefUnwindSafe for TreeNodeOptions
impl Send for TreeNodeOptions
impl Sync for TreeNodeOptions
impl Unpin for TreeNodeOptions
impl UnwindSafe for TreeNodeOptions
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