pub struct Tree<T>(/* private fields */);Expand description
A hierarchical tree view component.
Displays data in a tree structure with expandable/collapsible nodes. Supports keyboard navigation and single selection.
§Visual Format
▶ Documents
▼ Projects
├─ envision
│ ├─ src
│ └─ tests
└─ other§Keyboard Navigation
Up/Down- Move selectionRight- Expand nodeLeft- Collapse nodeEnter- Select/activate node
§Example
use envision::component::{Tree, TreeMessage, TreeOutput, TreeState, TreeNode, Component};
// Build tree structure
let mut docs = TreeNode::new("Documents", "docs");
docs.add_child(TreeNode::new("readme.md", "readme"));
docs.add_child(TreeNode::new("guide.md", "guide"));
let mut projects = TreeNode::new_expanded("Projects", "projects");
projects.add_child(TreeNode::new("envision", "envision"));
let mut state = TreeState::new(vec![docs, projects]);
// Navigate
Tree::update(&mut state, TreeMessage::SelectNext);
Tree::update(&mut state, TreeMessage::Expand);Trait Implementations§
Source§impl<T: Clone + 'static> Component for Tree<T>
impl<T: Clone + 'static> Component for Tree<T>
Source§type Message = TreeMessage
type Message = TreeMessage
Messages this component can receive. Read more
Source§type Output = TreeOutput
type Output = TreeOutput
Messages this component can emit to its parent. Read more
Auto Trait Implementations§
impl<T> Freeze for Tree<T>
impl<T> RefUnwindSafe for Tree<T>where
T: RefUnwindSafe,
impl<T> Send for Tree<T>where
T: Send,
impl<T> Sync for Tree<T>where
T: Sync,
impl<T> Unpin for Tree<T>where
T: Unpin,
impl<T> UnwindSafe for Tree<T>where
T: 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
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