pub struct AttributeSpec {
pub value_type: ValueType,
pub label: Option<String>,
pub name: Option<String>,
pub short: Option<String>,
pub description: Option<String>,
pub formula: Option<String>,
pub calc: Option<String>,
pub direction: Direction,
pub abbreviate: Option<bool>,
pub group: Option<String>,
pub thresholds: Option<Thresholds>,
pub omit_at: f64,
}Expand description
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.
Fields§
§value_type: ValueType§label: Option<String>Concise display label (table grouping, popup rows).
name: Option<String>Full name used as a tooltip title (falls back to label).
short: Option<String>Short label for narrow table headers (falls back to label).
description: Option<String>Long human description (tooltip body).
formula: Option<String>Human-readable formula, e.g. "sloc × (fan_in × fan_out)²" (display only).
calc: Option<String>Evaluable JS expression over sibling attribute names + Math, e.g.
"sloc * (fan_in * fan_out) ** 2". Lets the UI show the live derivation.
direction: DirectionWhether higher or lower is “better” — drives delta colouring. Neutral
(the default) is omitted from the wire.
abbreviate: Option<bool>Format large values with K/M suffixes.
group: Option<String>Optional group this attribute belongs to, by AttributeGroup key.
thresholds: Option<Thresholds>Optional two-tier thresholds (language-calibrated).
omit_at: f64Value at which this metric carries no signal and is omitted from the
node (absent in the JSON, blank in the viewer). 0 for almost everything;
1 for cyclomatic (McCabe’s floor — a function-less file would otherwise
report a vacuous 1). Published so the frontend knows what an absent cell
means (and may treat it as this value when sorting). Default 0 is omitted
from the wire.
Implementations§
Trait Implementations§
Source§impl Clone for AttributeSpec
impl Clone for AttributeSpec
Source§fn clone(&self) -> AttributeSpec
fn clone(&self) -> AttributeSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more