Skip to main content

Crate cursive_tree

Crate cursive_tree 

Source
Expand description

crates.io docs.rs

§Cursive Tree

A tree view for the Cursive TUI library.

Nodes can be leaves (no children) or branches (potentially have children) and can have custom data attached to them. Their representation can be stylized with multiple colors and effects.

Event handling (configurable):

  • Up/Down keys: move selection
  • PgUp/PgDown keys: move selection by 10 (configurable)
  • Left/Right keys: collapse/expand selected branch node
  • Enter key: toggle selected branch node collapse/expand
  • “-”/“+” keys: collapse/expand selected branch and all children recursively
  • “<”/“>” keys: collapse/expand all nodes
  • Mouse click on node: select
  • Mouse click to the left of the node: toggle branch collapse/expand

The TreeView’s data and behavior are backed by a TreeBackend. The nodes are stored and managed by a TreeModel. The model can be populated in advance and can also fetch data from the backend on demand, e.g. when a branch node is expanded.

Check out the examples.

§Alternatives

cursive_tree_view seems to be abandoned. It is written for an older version of Cursive but may still work.

§License

Like much of the Rust ecosystem, licensed under your choice of either of

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

All code and documentation was written by humans. We do not accept “AI”-generated contributions.

Structs§

Node
Tree node.
NodeIterator
Tree node iterator.
NodeList
Tree node list.
SimpleTreeBackend
Simple tree view backend.
TreeModel
Tree model.
TreeView
Tree view.

Enums§

Action
Tree view action.
BranchState
State for Branch tree node.
NodeKind
Tree node kind.
Symbol
Tree node symbol.

Constants§

DEFAULT_BRANCH_COLLAPSED_SYMBOL
Default branch collapsed symbol. Unicode U+25B6.
DEFAULT_BRANCH_EXPANDED_SYMBOL
Default branch expanded symbol. Unicode U+25BC.
DEFAULT_LEAF_SYMBOL
Default leaf symbol. Unicode U+25AA.

Traits§

Depth
Tree node depth.
TreeBackend
Tree view backend.

Type Aliases§

Actions
Tree view action map.
NodePath
Tree node path.
Representation
Tree node representation.