pub struct TreeViewItem {
pub id: String,
pub label: String,
pub icon: Option<String>,
pub children: Vec<TreeViewItem>,
pub selectable: bool,
pub toggleable: bool,
}Expand description
A tree view item that can contain child items
Fields§
§id: StringUnique identifier for this item
label: StringDisplay label for the item
icon: Option<String>Optional icon (Material Symbol name)
children: Vec<TreeViewItem>Child items
selectable: boolWhether this item is selectable
toggleable: boolWhether this item can toggle (show/hide children)
Implementations§
Source§impl TreeViewItem
impl TreeViewItem
Sourcepub fn new(id: impl Into<String>, label: impl Into<String>) -> Self
pub fn new(id: impl Into<String>, label: impl Into<String>) -> Self
Create a new tree view item
Sourcepub fn child(self, child: TreeViewItem) -> Self
pub fn child(self, child: TreeViewItem) -> Self
Add a child item
Sourcepub fn children(self, children: Vec<TreeViewItem>) -> Self
pub fn children(self, children: Vec<TreeViewItem>) -> Self
Add multiple children
Sourcepub fn selectable(self, selectable: bool) -> Self
pub fn selectable(self, selectable: bool) -> Self
Set whether this item is selectable
Sourcepub fn toggleable(self, toggleable: bool) -> Self
pub fn toggleable(self, toggleable: bool) -> Self
Set whether this item is toggleable
Sourcepub fn has_children(&self) -> bool
pub fn has_children(&self) -> bool
Check if this item has children
Trait Implementations§
Source§impl Clone for TreeViewItem
impl Clone for TreeViewItem
Source§fn clone(&self) -> TreeViewItem
fn clone(&self) -> TreeViewItem
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TreeViewItem
impl RefUnwindSafe for TreeViewItem
impl Send for TreeViewItem
impl Sync for TreeViewItem
impl Unpin for TreeViewItem
impl UnsafeUnpin for TreeViewItem
impl UnwindSafe for TreeViewItem
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