cursive-tree 0.0.9

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

/// State for [Branch](super::kind::NodeKind::Branch) tree node.
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub enum BranchState {
    /// The branch node is expanded.
    Expanded,

    /// The branch node is collapsed.
    #[default]
    Collapsed,
}

impl BranchState {
    /// Whether the branch node is expanded.
    pub fn is_expanded(&self) -> bool {
        matches!(self, Self::Expanded)
    }

    /// Whether the branch node is collapsed.
    pub fn is_collapsed(&self) -> bool {
        matches!(self, Self::Collapsed)
    }
}