pub struct Tree<T> { /* private fields */ }Expand description
A hierarchical tree widget with expandable/collapsible nodes.
Displays a forest of TreeNodes as an indented list. Supports
keyboard navigation, expand/collapse, and optional lazy loading.
Implementations§
Source§impl<T> Tree<T>
impl<T> Tree<T>
Sourcepub fn with_render_fn<F>(self, f: F) -> Self
pub fn with_render_fn<F>(self, f: F) -> Self
Set a custom render function for nodes.
Parameters: (data, depth, expanded, is_leaf) -> Segments
Sourcepub fn with_node_style(self, style: Style) -> Self
pub fn with_node_style(self, style: Style) -> Self
Set the style for unselected nodes.
Sourcepub fn with_selected_style(self, style: Style) -> Self
pub fn with_selected_style(self, style: Style) -> Self
Set the style for the selected node.
Sourcepub fn with_border(self, border: BorderStyle) -> Self
pub fn with_border(self, border: BorderStyle) -> Self
Set the border style.
Sourcepub fn with_lazy_load<F>(self, f: F) -> Self
pub fn with_lazy_load<F>(self, f: F) -> Self
Set a lazy load function for deferred child loading.
Sourcepub fn scroll_offset(&self) -> usize
pub fn scroll_offset(&self) -> usize
Get the scroll offset.
Sourcepub fn toggle_selected(&mut self)
pub fn toggle_selected(&mut self)
Toggle expand/collapse at the selected node.
Sourcepub fn expand_selected(&mut self)
pub fn expand_selected(&mut self)
Expand the selected node (load children lazily if needed).
Sourcepub fn collapse_selected(&mut self)
pub fn collapse_selected(&mut self)
Collapse the selected node.
Sourcepub fn selected_node(&self) -> Option<&TreeNode<T>>
pub fn selected_node(&self) -> Option<&TreeNode<T>>
Get a reference to the data of the selected visible node.
Sourcepub fn visible_count(&self) -> usize
pub fn visible_count(&self) -> usize
Get the total number of visible nodes.
Trait Implementations§
Source§impl<T> InteractiveWidget for Tree<T>
impl<T> InteractiveWidget for Tree<T>
Source§fn handle_event(&mut self, event: &Event) -> EventResult
fn handle_event(&mut self, event: &Event) -> EventResult
Handle an input event. Returns whether the event was consumed.
Auto Trait Implementations§
impl<T> Freeze for Tree<T>
impl<T> !RefUnwindSafe for Tree<T>
impl<T> !Send for Tree<T>
impl<T> !Sync for Tree<T>
impl<T> Unpin for Tree<T>where
T: Unpin,
impl<T> !UnwindSafe for Tree<T>
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