cursive_tree/model/state.rs
1//
2// BranchState
3//
4
5/// State for [Branch](super::kind::NodeKind::Branch) tree node.
6#[derive(Clone, Copy, Debug, Default)]
7pub enum BranchState {
8 /// The branch node is expanded.
9 Expanded,
10
11 /// The branch node is collapsed.
12 #[default]
13 Collapsed,
14}
15
16impl BranchState {
17 /// Whether the branch node is expanded.
18 pub fn is_expanded(&self) -> bool {
19 matches!(self, Self::Expanded)
20 }
21
22 /// Whether the branch node is collapsed.
23 pub fn is_collapsed(&self) -> bool {
24 matches!(self, Self::Collapsed)
25 }
26}