#[non_exhaustive]pub struct ElementCountNode {
pub kind: ElementNodeKind,
pub id: usize,
pub name: String,
pub span: Option<Span>,
pub base_count: usize,
pub adjustment: isize,
pub count: usize,
pub children: Vec<ElementCountNode>,
}Expand description
One node’s contribution and its nested element-count analysis.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.kind: ElementNodeKind§id: usizeAn opaque identity unique within this report. It is not a WIR or storage arena index and has no meaning across reports.
name: StringThe canonical Workshop or analysis name for this node.
span: Option<Span>The authored source span, when the program retained one.
base_count: usizeThe node-local contribution before child counts and adjustments.
adjustment: isizeThe signed node-local adjustment, such as a direct-argument reduction or hero-pair surcharge.
count: usizeThe node’s recursive count: base_count + adjustment + children.
children: Vec<ElementCountNode>Nested values, conditions, and actions in canonical source order.
Implementations§
Source§impl ElementCountNode
impl ElementCountNode
Sourcepub fn height(&self) -> usize
pub fn height(&self) -> usize
The number of nodes on the longest downward path starting at this
node: 1 for a leaf, otherwise 1 + max(child heights).
This is a structural measure of the report tree, not a client limit; it answers “how deeply nested is this subtree” without claiming anything about importability.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
The number of nodes in this subtree, including this node.
Unlike count, which is the weighted client element cost, this is
the plain cardinality of the report subtree.
Sourcepub fn statement_value_nodes(&self) -> usize
pub fn statement_value_nodes(&self) -> usize
The number of value nodes in this node’s own statement value trees:
Value nodes reachable from this node without entering a descendant
Action subtree.
On an Action this counts its own argument trees; actions nested in
block bodies are separate statements and are excluded. On a
Condition it is the condition’s value tree, and on a Rule it is
the conditions’ value trees only — each action carries its own
statement. On a Value node this equals node_count().
A comparison keeps its operator as a Value node inside an If or
While argument, while a rule condition absorbs it into the
Condition node — so one source expression measures one node fewer
as a rule condition than as a block condition.