parallel_disk_usage/visualizer/parenthood.rs
1/// Whether a node in a tree has children.
2#[derive(Debug, Clone, Copy, PartialEq, Eq)]
3pub enum Parenthood {
4 /// The node has no children.
5 Childless,
6 /// The node has children.
7 Parent,
8}
9
10impl Parenthood {
11 /// Deduce parenthood from the number of children.
12 #[inline]
13 pub const fn from_children_count(children_count: usize) -> Self {
14 if children_count == 0 {
15 Parenthood::Childless
16 } else {
17 Parenthood::Parent
18 }
19 }
20}