cursive-tree 0.0.9

Tree view for the Cursive TUI library
Documentation
//
// NodeKind
//

/// Tree node kind.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum NodeKind {
    /// A branch is a node that can have children.
    Branch,

    /// A leaf is a node that cannot have children.
    Leaf,
}

impl NodeKind {
    /// Whether the node is a branch.
    pub fn is_branch(&self) -> bool {
        matches!(self, Self::Branch)
    }

    /// Whether the node is a leaf.
    pub fn is_leaf(&self) -> bool {
        matches!(self, Self::Leaf)
    }
}