crate::ix!();
impl SkeletonNode {
pub fn id(&self) -> u16 {
match self {
SkeletonNode::Dispatch { id, .. } => *id,
SkeletonNode::Aggregate { id, .. } => *id,
SkeletonNode::LeafHolder { id, .. } => *id,
}
}
pub fn parent_id(&self) -> Option<u16> {
match self {
SkeletonNode::Dispatch { parent_id, .. } => *parent_id,
SkeletonNode::Aggregate { parent_id, .. } => *parent_id,
SkeletonNode::LeafHolder { parent_id, .. } => *parent_id,
}
}
pub fn child_ids(&self) -> &[u16] {
match self {
SkeletonNode::Dispatch { child_ids, .. } => child_ids,
SkeletonNode::Aggregate { child_ids, .. } => child_ids,
SkeletonNode::LeafHolder { .. } => &[],
}
}
pub fn leaf_count(&self) -> u16 {
match self {
SkeletonNode::LeafHolder { leaf_count, .. } => *leaf_count,
_ => 0,
}
}
pub fn capstone(&self) -> bool {
match self {
SkeletonNode::LeafHolder { capstone, .. } => *capstone,
_ => false,
}
}
pub fn name(&self) -> &str {
match self {
SkeletonNode::Dispatch { name, .. } => name,
SkeletonNode::Aggregate { name, .. } => name,
SkeletonNode::LeafHolder { name, .. } => name,
}
}
pub fn original_key(&self) -> &str {
match self {
SkeletonNode::Dispatch { original_key, .. } => original_key,
SkeletonNode::Aggregate { original_key, .. } => original_key,
SkeletonNode::LeafHolder { original_key, .. } => original_key,
}
}
pub fn ordering(&self) -> &Option<SubBranchOrdering> {
match self {
SkeletonNode::Dispatch { ordering, .. } => ordering,
SkeletonNode::Aggregate { ordering, .. } => ordering,
SkeletonNode::LeafHolder { ordering, .. } => ordering,
}
}
}