cursive_tree/model/kind.rs
1//
2// NodeKind
3//
4
5/// Tree node kind.
6#[derive(Clone, Copy, Debug, Eq, PartialEq)]
7pub enum NodeKind {
8 /// A branch is a node that can have children.
9 Branch,
10
11 /// A leaf is a node that cannot have children.
12 Leaf,
13}
14
15impl NodeKind {
16 /// Whether the node is a branch.
17 pub fn is_branch(&self) -> bool {
18 matches!(self, Self::Branch)
19 }
20
21 /// Whether the node is a leaf.
22 pub fn is_leaf(&self) -> bool {
23 matches!(self, Self::Leaf)
24 }
25}