tree only.Expand description
Hierarchical items that expand and collapse, such as folders and files.
State holds the nodes keyed by id, which are expanded, and the
selection. Its update handles expanding, pointer and
keyboard selection in the chosen Mode, checkboxes with tri-state
parents, and children that load later. The view only builds the rows of
expanded nodes that are in view, so a tree of thousands of nodes stays
quick.
A node made with Node::lazy has children that are not loaded yet.
Expanding it marks it loading and returns Output::Load; the app
fetches the children and sends them back through the channel that
subscription owns, as Loaded batches.
The tree resolves its keys through a Keymap of Actions while it
has focus, which it takes when pressed; see default_keymap. Letters
and digits jump to the next node starting with them.
Structs§
- Loaded
- Children that arrived for a lazy node.
- Node
- One node: its label and look. Its children are given with
children, or later withNode::lazy. - RowStyle
- The colours of a row.
- State
- The nodes, their structure and what is expanded, selected and checked.
- Status
- How a row is shown.
- Tree
- A tree builder. Convert it into an
Elementto render.
Enums§
- Action
- What a tree keyboard shortcut does.
- Event
- Everything that changes a tree.
- Mode
- How nodes are selected.
- Output
- What the app may need to act on after an
Event. - Trailing
- What sits at the end of a row.
Constants§
- BATCH_
SIZE - The most batches delivered in one
Event::Received. - CHANNEL_
CAPACITY - How many loaded batches a producer can send before it has to wait.
- INDENT
- Width of one level of indentation, which is also the chevron’s slot.
- ROW_
HEIGHT - Height of every row, as in a menu.
Functions§
- default_
keymap - The default tree shortcuts:
- guide_
colour - The colour of the indentation guides.
- loaded
- The children of
parent, to send through the channel. - node
- Creates a leaf node.
- row_
style - Resolves a row’s colours from the shared menu rows: a selected row is drawn as a highlighted menu row, and a hovered one with a lighter tint.
- stream
- The stream behind
subscription, for driving it without a runtime. - subscription
- Owns the channel lazy children arrive on. Emits
Event::Readyfirst, then batches. - tree
- Renders
state. Withouton_eventevery row renders disabled.
Type Aliases§
- Sender
- The sending half of the channel lazy children arrive on. Clone it for each producer.