Skip to main content

TreeSliceHandle

Struct TreeSliceHandle 

Source
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>

Source

pub fn visible_count(&self) -> usize

Number of currently-visible (flattened) rows.

Source

pub fn entry_at(&self, flat_index: usize) -> Option<FlatEntry>

Get the FlatEntry at flat_index (cloned), or None if out of bounds.

Source

pub fn visible_node_id(&self, flat_index: usize) -> Option<NodeId>

Get the NodeId at flat_index, or None if out of bounds.

Source

pub fn expand(&self, node: NodeId)

Expand node (make its children visible) and bump the version signal. No-op if already expanded.

Source

pub fn collapse(&self, node: NodeId)

Collapse node (hide its children) and bump the version signal. No-op if already collapsed.

Source

pub fn is_expanded(&self, node: NodeId) -> bool

Returns true if node is currently expanded.

Source

pub fn toggle_expand(&self, node: NodeId)

Toggle node’s expand/collapse state and bump the version signal.

Source

pub fn tree(&self) -> &TreeModel<T>

Access the underlying TreeModel.

Source

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.

Source

pub fn first_changed_index(&self) -> Option<usize>

Trait Implementations§

Source§

impl<T: 'static> Clone for TreeSliceHandle<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for TreeSliceHandle<T>

§

impl<T> !Send for TreeSliceHandle<T>

§

impl<T> !Sync for TreeSliceHandle<T>

§

impl<T> !UnwindSafe for TreeSliceHandle<T>

§

impl<T> Freeze for TreeSliceHandle<T>

§

impl<T> Unpin for TreeSliceHandle<T>

§

impl<T> UnsafeUnpin for TreeSliceHandle<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.