pub struct Tree<'a, T>{ /* private fields */ }Expand description
A Tree which can be rendered.
§Example
let mut state = TreeState::default();
let item = TreeItem::new_leaf("leaf");
let items = vec![item];
terminal.draw(|frame| {
let area = frame.area();
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, T> Tree<'a, T>
impl<'a, T> Tree<'a, T>
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. It’s there to test and experiment with what’s 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, T> StatefulWidget for Tree<'a, T>
impl<'a, T> StatefulWidget for Tree<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for Tree<'a, T>
impl<'a, T> RefUnwindSafe for Tree<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for Tree<'a, T>where
T: Sync,
impl<'a, T> Sync for Tree<'a, T>where
T: Sync,
impl<'a, T> Unpin for Tree<'a, T>
impl<'a, T> UnwindSafe for Tree<'a, T>where
T: 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