pub struct TreeViewState {
pub collapsed: HashSet<String>,
pub selected_index: usize,
pub scroll: u16,
}Expand description
State for the tree view widget
Fields§
§collapsed: HashSet<String>Set of collapsed node IDs
selected_index: usizeCurrently selected index in the flattened visible list
scroll: u16Scroll offset
Implementations§
Source§impl TreeViewState
impl TreeViewState
Sourcepub fn toggle_collapsed(&mut self, id: &str)
pub fn toggle_collapsed(&mut self, id: &str)
Toggle the collapsed state of a node
Sourcepub fn is_collapsed(&self, id: &str) -> bool
pub fn is_collapsed(&self, id: &str) -> bool
Check if a node is collapsed
Sourcepub fn select_prev(&mut self)
pub fn select_prev(&mut self)
Move selection up
Sourcepub fn select_next(&mut self, total_visible: usize)
pub fn select_next(&mut self, total_visible: usize)
Move selection down (needs total count)
Sourcepub fn ensure_visible(&mut self, viewport_height: usize)
pub fn ensure_visible(&mut self, viewport_height: usize)
Ensure selection is visible given viewport height
Trait Implementations§
Source§impl Clone for TreeViewState
impl Clone for TreeViewState
Source§fn clone(&self) -> TreeViewState
fn clone(&self) -> TreeViewState
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 moreSource§impl Debug for TreeViewState
impl Debug for TreeViewState
Source§impl Default for TreeViewState
impl Default for TreeViewState
Source§fn default() -> TreeViewState
fn default() -> TreeViewState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TreeViewState
impl RefUnwindSafe for TreeViewState
impl Send for TreeViewState
impl Sync for TreeViewState
impl Unpin for TreeViewState
impl UnwindSafe for TreeViewState
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