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<Identifier> StatefulWidget for Tree<'_, Identifier>
impl<Identifier> StatefulWidget for Tree<'_, Identifier>
Auto Trait Implementations§
impl<'a, Identifier> Freeze for Tree<'a, Identifier>
impl<'a, Identifier> RefUnwindSafe for Tree<'a, Identifier>where
Identifier: RefUnwindSafe,
impl<'a, Identifier> Send for Tree<'a, Identifier>where
Identifier: Sync,
impl<'a, Identifier> Sync for Tree<'a, Identifier>where
Identifier: Sync,
impl<'a, Identifier> Unpin for Tree<'a, Identifier>
impl<'a, Identifier> UnwindSafe for Tree<'a, Identifier>where
Identifier: RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more