pub struct Stats { /* private fields */ }Expand description
The Tokens metric: per-function and per-file count of tree-sitter
leaf tokens, excluding any leaf whose ancestor chain includes a
comment node.
This is a token-based size proxy: it counts the lexer’s tokens
(identifiers, literals, keywords, punctuation) rather than lines or
Halstead operators/operands. Punctuation that Halstead skips
(parentheses, semicolons, separators) does contribute, so
tokens ≠ Halstead N1 + N2.
Implementations§
Source§impl Stats
impl Stats
Sourcepub fn tokens_sum(&self) -> f64
pub fn tokens_sum(&self) -> f64
Returns the total token count across all merged spaces.
Sourcepub fn tokens_average(&self) -> f64
pub fn tokens_average(&self) -> f64
Returns the average tokens per space.
Sourcepub fn tokens_min(&self) -> f64
pub fn tokens_min(&self) -> f64
Returns the smallest single-space token count.
Diverges intentionally from nom::Stats::functions_min, which
surfaces the raw usize::MAX sentinel for a never-observed
space. We collapse the sentinel to 0.0 so a Stats::default()
that bypasses the metric pipeline serializes to a meaningful
number rather than 1.8446744e19.
Sourcepub fn tokens_max(&self) -> f64
pub fn tokens_max(&self) -> f64
Returns the largest single-space token count.