pub struct TreeState<K: Key> { /* private fields */ }Expand description
A tree’s state between passes: the cache, the selection, where it is scrolled.
Implementations§
Source§impl<K: Key> TreeState<K>
impl<K: Key> TreeState<K>
pub fn new() -> Self
Sourcepub fn handle(&self) -> TreeHandle<K>
pub fn handle(&self) -> TreeHandle<K>
The application’s hand on the view: edits from any thread.
pub fn selection(&self) -> &Selection<K>
Sourcepub fn set_selection(
&mut self,
keys: impl IntoIterator<Item = K>,
cursor: Option<K>,
)
pub fn set_selection( &mut self, keys: impl IntoIterator<Item = K>, cursor: Option<K>, )
Sets the selection without running a step (restoring a saved
state, following another view). Nodes the view has not loaded yet
(under a branch not opened, or still loading) are queued: the
selection takes each as it loads, and once all have come the
cursor’s row is brought into view. Open their ancestors
(TreeState::set_expanded) so that they load. The user
selecting, or another call, drops what was queued.
Sourcepub fn pending_selection(&self) -> Option<(&[K], Option<&K>)>
pub fn pending_selection(&self) -> Option<(&[K], Option<&K>)>
The selection queued by TreeState::set_selection for nodes
not loaded yet.
Sourcepub fn set_expanded(&mut self, key: &K, expanded: bool)
pub fn set_expanded(&mut self, key: &K, expanded: bool)
Opens or closes a branch without running a step (restoring a saved state).
Sourcepub fn rename(&mut self, key: &K)
pub fn rename(&mut self, key: &K)
Starts renaming a node in place, from its plain name
(Node::name).
Sourcepub fn reveal(&mut self, key: &K)
pub fn reveal(&mut self, key: &K)
Brings a node’s row into view at the next pass, if its row is there by then (open its ancestors first).
Sourcepub fn set_filter(&mut self, text: impl Into<String>)
pub fn set_filter(&mut self, text: impl Into<String>)
Filters the tree (empty: no filter), from its next draw: the nodes
matching every word (the filter says how) show with their
ancestors, the rest is hidden, and the cursor goes to the first
match when its row hides. A FilterField types it.
Sourcepub fn filter_count(&self) -> Option<(usize, usize)>
pub fn filter_count(&self) -> Option<(usize, usize)>
While the tree filters: how many nodes match, and how many it has loaded.
Sourcepub fn dropped(&self) -> u64
pub fn dropped(&self) -> u64
Edits dropped since the tree was made: they waited past
EDITS_WAITING while the tree was not drawn, and every branch
was loaded again instead.
Sourcepub fn waiting(&self) -> usize
pub fn waiting(&self) -> usize
Edits waiting for the next pass (at most EDITS_WAITING).
Trait Implementations§
Auto Trait Implementations§
impl<K> Freeze for TreeState<K>where
K: Freeze,
impl<K> RefUnwindSafe for TreeState<K>where
K: RefUnwindSafe,
impl<K> Send for TreeState<K>where
K: Send,
impl<K> Sync for TreeState<K>
impl<K> Unpin for TreeState<K>where
K: Unpin,
impl<K> UnsafeUnpin for TreeState<K>where
K: UnsafeUnpin,
impl<K> UnwindSafe for TreeState<K>where
K: 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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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