pub struct Tree { /* private fields */ }Expand description
A node in a hierarchy. Mirrors rich.tree.Tree.
Implementations§
Source§impl Tree
impl Tree
Sourcepub fn new(label: impl Into<Cell>) -> Self
pub fn new(label: impl Into<Cell>) -> Self
A new tree/subtree with the given label. A string label is console
markup, as upstream’s Tree("[b]root") is; pass a
Text for a literal one.
Sourcepub fn highlight(self, highlight: bool) -> Self
pub fn highlight(self, highlight: bool) -> Self
Highlight string labels (upstream Tree(highlight=…), default off).
Upstream renders every label with the root’s setting.
Sourcepub fn style(self, style: impl Into<StyleType>) -> Self
pub fn style(self, style: impl Into<StyleType>) -> Self
The style of this node’s label and, stacked, its descendants’
(upstream Tree(style=…), default "tree").
Sourcepub fn guide_style(self, style: impl Into<StyleType>) -> Self
pub fn guide_style(self, style: impl Into<StyleType>) -> Self
The style of the guide lines below this node (upstream
Tree(guide_style=…), default "tree.line"). Bold selects the heavy
guides and underline2 the double ones.
Sourcepub fn expanded(self, expanded: bool) -> Self
pub fn expanded(self, expanded: bool) -> Self
Whether this node’s children are shown (upstream expanded, default
on).
Sourcepub fn hide_root(self, hide_root: bool) -> Self
pub fn hide_root(self, hide_root: bool) -> Self
Hide the root node, rendering its children as the top level (upstream
hide_root, default off; read from the root only).
Sourcepub fn set_guide_style(&mut self, style: impl Into<StyleType>) -> &mut Self
pub fn set_guide_style(&mut self, style: impl Into<StyleType>) -> &mut Self
Set guide_style in place.
Sourcepub fn set_expanded(&mut self, expanded: bool) -> &mut Self
pub fn set_expanded(&mut self, expanded: bool) -> &mut Self
Set expanded in place (upstream assigns
tree.expanded).
Sourcepub fn set_hide_root(&mut self, hide_root: bool) -> &mut Self
pub fn set_hide_root(&mut self, hide_root: bool) -> &mut Self
Set hide_root in place.
Sourcepub fn set_highlight(&mut self, highlight: bool) -> &mut Self
pub fn set_highlight(&mut self, highlight: bool) -> &mut Self
Set highlight in place.
Sourcepub fn get_guide_style(&self) -> &StyleType
pub fn get_guide_style(&self) -> &StyleType
The node’s guide style (see guide_style).
Sourcepub fn is_expanded(&self) -> bool
pub fn is_expanded(&self) -> bool
Whether children are shown.
Whether the root is hidden.
Sourcepub fn is_highlighted(&self) -> bool
pub fn is_highlighted(&self) -> bool
Whether string labels are highlighted.
Sourcepub fn children_mut(&mut self) -> &mut Vec<Tree>
pub fn children_mut(&mut self) -> &mut Vec<Tree>
The child nodes, mutably.
Trait Implementations§
Source§impl Drop for Tree
impl Drop for Tree
Source§impl Renderable for Tree
impl Renderable for Tree
Source§fn measure(&self, console: &Console, options: &ConsoleOptions) -> Measurement
fn measure(&self, console: &Console, options: &ConsoleOptions) -> Measurement
Port of Tree.__rich_measure__: the widest label plus its indent of
four cells per level, for both bounds.
fn rich_render( &self, console: &Console, options: &ConsoleOptions, ) -> Vec<Segment>
Source§fn fit_to_measurement(&self) -> bool
fn fit_to_measurement(&self) -> bool
Console::print shrinks this renderable to its
measured width. Upstream renders every top-level renderable at the full
console width, so the default is false; an extension may opt in.