pub struct TreeSliceHandle<T: 'static> { /* private fields */ }Expand description
Lightweight handle to a TreeSlice’s shared state, usable in closures.
Created via TreeSlice::handle. Shares all Rc-based internals with its
parent TreeSlice but does not keep the tree-change observer alive —
the TreeSlice that owns the observer must outlive all handles that rely on
automatic re-flattening on model changes.
Implementations§
Source§impl<T: 'static> TreeSliceHandle<T>
impl<T: 'static> TreeSliceHandle<T>
Sourcepub fn visible_count(&self) -> usize
pub fn visible_count(&self) -> usize
Number of currently-visible (flattened) rows.
Sourcepub fn entry_at(&self, flat_index: usize) -> Option<FlatEntry>
pub fn entry_at(&self, flat_index: usize) -> Option<FlatEntry>
Get the FlatEntry at flat_index (cloned), or None if out of bounds.
Sourcepub fn visible_node_id(&self, flat_index: usize) -> Option<NodeId>
pub fn visible_node_id(&self, flat_index: usize) -> Option<NodeId>
Get the NodeId at flat_index, or None if out of bounds.
Sourcepub fn expand(&self, node: NodeId)
pub fn expand(&self, node: NodeId)
Expand node (make its children visible) and bump the version signal.
No-op if already expanded.
Sourcepub fn collapse(&self, node: NodeId)
pub fn collapse(&self, node: NodeId)
Collapse node (hide its children) and bump the version signal.
No-op if already collapsed.
Sourcepub fn is_expanded(&self, node: NodeId) -> bool
pub fn is_expanded(&self, node: NodeId) -> bool
Returns true if node is currently expanded.
Sourcepub fn toggle_expand(&self, node: NodeId)
pub fn toggle_expand(&self, node: NodeId)
Toggle node’s expand/collapse state and bump the version signal.
Sourcepub fn expand_all(&self)
pub fn expand_all(&self)
Expand every node with children — see TreeSlice::expand_all. Useful
after a model rebuild reassigns NodeIds (the old expand set no longer
matches), to keep the view fully expanded.