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(|f| {
let area = f.size();
let tree_widget = Tree::new(items)
.expect("all item identifiers are unique")
.block(Block::new().borders(Borders::ALL).title("Tree Widget"));
f.render_stateful_widget(tree_widget, area, &mut state);
})?;Implementations§
source§impl<'a, Identifier> Tree<'a, Identifier>where
Identifier: Clone + PartialEq + Eq + Hash,
impl<'a, Identifier> Tree<'a, Identifier>where Identifier: Clone + PartialEq + Eq + Hash,
pub fn block(self, block: Block<'a>) -> Self
pub const fn start_corner(self, corner: Corner) -> Self
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§
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