Struct tui_tree_widget::Tree
source · pub struct Tree<'a, Identifier> { /* private fields */ }Expand description
A Tree which can be rendered.
The generic argument Identifier is used to keep the state like the currently selected or opened TreeItems in the TreeState.
For more information see TreeItem.
§Example
let mut state = TreeState::default();
let item = TreeItem::new_leaf("l", "leaf");
let items = vec![item];
terminal.draw(|frame| {
let area = frame.size();
let tree_widget = Tree::new(items)
.expect("all item identifiers are unique")
.block(Block::bordered().title("Tree Widget"));
frame.render_stateful_widget(tree_widget, area, &mut state);
})?;Implementations§
source§impl<'a, Identifier> Tree<'a, Identifier>
impl<'a, Identifier> Tree<'a, Identifier>
pub fn block(self, block: Block<'a>) -> Self
sourcepub const fn experimental_scrollbar(
self,
scrollbar: Option<Scrollbar<'a>>
) -> Self
pub const fn experimental_scrollbar( self, scrollbar: Option<Scrollbar<'a>> ) -> Self
Show the scrollbar when rendering this widget.
Experimental: Can change on any release without any additional notice. Its there to test and experiment with whats possible with scrolling widgets. Also see https://github.com/ratatui-org/ratatui/issues/174
pub const fn style(self, style: Style) -> Self
pub const fn highlight_style(self, style: Style) -> Self
pub const fn highlight_symbol(self, highlight_symbol: &'a str) -> Self
pub const fn node_closed_symbol(self, symbol: &'a str) -> Self
pub const fn node_open_symbol(self, symbol: &'a str) -> Self
pub const fn node_no_children_symbol(self, symbol: &'a str) -> Self
Trait Implementations§
source§impl<'a, Identifier> StatefulWidget for Tree<'a, Identifier>
impl<'a, Identifier> StatefulWidget for Tree<'a, Identifier>
Auto Trait Implementations§
impl<'a, Identifier> RefUnwindSafe for Tree<'a, Identifier>where
Identifier: RefUnwindSafe,
impl<'a, Identifier> Send for Tree<'a, Identifier>where
Identifier: Send,
impl<'a, Identifier> Sync for Tree<'a, Identifier>where
Identifier: Sync,
impl<'a, Identifier> Unpin for Tree<'a, Identifier>where
Identifier: Unpin,
impl<'a, Identifier> UnwindSafe for Tree<'a, Identifier>where
Identifier: 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