pub struct State<Id> { /* private fields */ }tree only.Expand description
The nodes, their structure and what is expanded, selected and checked.
Implementations§
Source§impl<Id: Copy + Eq + Hash> State<Id>
impl<Id: Copy + Eq + Hash> State<Id>
Sourcepub fn new(roots: impl IntoIterator<Item = Node<Id>>) -> Self
pub fn new(roots: impl IntoIterator<Item = Node<Id>>) -> Self
A tree in Mode::Single with every node collapsed. Ids must be
unique across the whole tree.
pub fn with_mode(self, mode: Mode) -> Self
Sourcepub fn with_expanded(self, ids: impl IntoIterator<Item = Id>) -> Self
pub fn with_expanded(self, ids: impl IntoIterator<Item = Id>) -> Self
Starts with these nodes expanded. Lazy nodes stay collapsed until the user expands them, so nothing loads unasked.
pub fn mode(&self) -> Mode
pub fn roots(&self) -> &[Id]
pub fn node(&self, id: Id) -> Option<&Node<Id>>
pub fn parent(&self, id: Id) -> Option<Id>
Sourcepub fn children(&self, id: Id) -> &[Id]
pub fn children(&self, id: Id) -> &[Id]
The loaded children of a node, empty for a leaf or a node whose children have not arrived.
Sourcepub fn has_children(&self, id: Id) -> bool
pub fn has_children(&self, id: Id) -> bool
Whether a node has children, or may have once they load.
Sourcepub fn is_loaded(&self, id: Id) -> bool
pub fn is_loaded(&self, id: Id) -> bool
Whether a node’s children are known: a leaf, or loaded.
pub fn is_loading(&self, id: Id) -> bool
Sourcepub fn set_loading(&mut self, id: Id)
pub fn set_loading(&mut self, id: Id)
Marks a node as loading, such as while the app refreshes it. Its children stay until new ones arrive.
pub fn is_expanded(&self, id: Id) -> bool
pub fn is_selected(&self, id: Id) -> bool
pub fn is_focused(&self) -> bool
Sourcepub fn highlighted(&self) -> Option<Id>
pub fn highlighted(&self) -> Option<Id>
The node the keyboard acts on.
Sourcepub fn check_state(&self, id: Id) -> CheckState
pub fn check_state(&self, id: Id) -> CheckState
Whether a node’s checkbox is checked, unchecked, or indeterminate because only some of its children are checked.
Sourcepub fn visible(&self) -> Vec<Id>
pub fn visible(&self) -> Vec<Id>
The nodes on screen when scrolled through: roots and the children of expanded nodes, in tree order.
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl<Id> Freeze for State<Id>
impl<Id> RefUnwindSafe for State<Id>where
Vec<Id>: RefUnwindSafe,
HashMap<Id, Slot<Id>>: RefUnwindSafe,
HashSet<Id>: RefUnwindSafe,
Option<Id>: RefUnwindSafe,
impl<Id> Send for State<Id>
impl<Id> Sync for State<Id>
impl<Id> Unpin for State<Id>
impl<Id> UnsafeUnpin for State<Id>where
Vec<Id>: UnsafeUnpin,
HashMap<Id, Slot<Id>>: UnsafeUnpin,
HashSet<Id>: UnsafeUnpin,
Option<Id>: UnsafeUnpin,
impl<Id> UnwindSafe for State<Id>where
Vec<Id>: UnwindSafe,
HashMap<Id, Slot<Id>>: UnwindSafe,
HashSet<Id>: UnwindSafe,
Option<Id>: 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.