Skip to main content

Module level

Module level 

Source
Expand description

Level descriptors + the semantics dictionaries that let the core handle unknown kinds/keys without hardcoding their names, and let the UI render any language/metric set purely from data: edge kinds (EdgeKindSpec), node/edge attributes (AttributeSpec, grouped via AttributeGroup), node kinds (NodeKindSpec) and cycle kinds (CycleKindSpec).

The dictionaries are maps keyed by the kind/attribute/group name; the spec value holds only the remaining metadata.

Structs§

AttributeGroup
A named group of attributes (UI section). Keyed by group name in Level::attribute_groups; attributes reference it via AttributeSpec::group. Metadata only — storage stays flat.
AttributeSpec
Describes one attribute key (on a node or an edge). Everything the UI needs to label, explain, format, compute and threshold the metric — so the viewer hardcodes no metric by name.
CycleKindSpec
Label + description of one cycle kind ("mutual" / "chain").
EdgeKindSpec
Semantics of one edge kind. Keyed by the edge kind in Level::edge_kinds. flow is the single source of truth for “is this information flow”: counted in coupling/cycles AND drawn when true; structural (e.g. contains) and excluded/hidden when false.
Grouping
How the viewer should cluster nodes in the diagram. Exactly one of key (group by the value of a node attribute, e.g. crate) or function (a named grouper the viewer implements, e.g. dir — derive the folder from the path). Absent → the viewer falls back to its default dir grouper.
Level
An analysis level the plugin can produce, with the semantics needed to score and draw it. The orchestrator merges in centrally-computed attribute specs and the computed ui block before writing the snapshot.
NodeKindSpec
Visual + label semantics of one node kind ("file" / "external" / …). Keyed by kind in Level::node_kinds.
SpecRow
One row of a declarative attribute table: a flat, named-field description of an AttributeSpec. Empty &str fields become None; direction defaults to Direction::Neutral. Build a whole dictionary with attr_dict.
Thresholds
Two-tier per-metric thresholds (at/under info is fine; above warning is likely a problem). Carried on an AttributeSpec; produced by a plugin (language-calibrated), absent when a metric has no calibration.

Enums§

Direction
Whether a metric’s delta is “good” when it moves up or down — drives the green/red colouring in the viewer. Neutral (the default) means the metric has no agreed-good direction (raw sizes, structural counts) and is left uncoloured. Neutral is skipped on the wire, so a neutral metric serializes exactly as the old Option<String> form did: the direction field absent.

Functions§

attr_dict
Assemble a key → AttributeSpec dictionary from a declarative table.
group
Build an AttributeGroup from a label + description.