Leaf {
name: Box<Value>,
class: Option<Class>,
- label_depth: usize,
extra_depth: usize,
},
}
Self::Leaf {
name,
class,
- label_depth,
extra_depth,
} => {
let leaf = Arc::new(Leaf {
parent,
name,
- label_depth,
extra_depth,
class,
});
fn assign_label_depth(&mut self, label_position: LabelPosition) {
match self {
CategoryBuilder::Group(group) => group.assign_label_depth(label_position, false),
- CategoryBuilder::Leaf { label_depth, .. } => {
- *label_depth = 1;
- }
+ CategoryBuilder::Leaf { .. } => (),
}
}
fn distribute_extra_depth(&mut self, extra: usize) {
fn label_depth(&self) -> usize {
match self {
CategoryBuilder::Group(group) => group.label_depth,
- CategoryBuilder::Leaf { label_depth, .. } => *label_depth,
+ CategoryBuilder::Leaf { .. } => 1,
}
}
fn set_label_depth(&mut self, depth: usize) {
match self {
CategoryBuilder::Group(group) => group.label_depth = depth,
- CategoryBuilder::Leaf { label_depth, .. } => *label_depth = depth,
+ CategoryBuilder::Leaf { .. } => (),
}
}
}
Self::Leaf {
name: Box::new(name),
class: None,
- label_depth: 0,
extra_depth: 0,
}
}
Self::Leaf {
name: Box::new(name),
class: Some(class),
- label_depth: 0,
extra_depth: 0,
}
}
pub struct Leaf {
parent: Weak<Group>,
name: Box<Value>,
- label_depth: usize,
extra_depth: usize,
/// Default format for values in this category.
Self {
parent: Weak::new(),
name: Box::new(name),
- label_depth: 0,
extra_depth: 0,
class: None,
}
}
fn label_depth(&self) -> usize {
- self.label_depth
+ 1
}
fn extra_depth(&self) -> usize {