#[non_exhaustive]pub struct Stats { /* private fields */ }Expand description
The NArgs metric.
This metric counts the number of arguments of functions/closures.
Implementations§
Source§impl Stats
impl Stats
Sourcepub fn function_args(&self) -> u64
pub fn function_args(&self) -> u64
Returns the number of function arguments in a space.
Sourcepub fn closure_args(&self) -> u64
pub fn closure_args(&self) -> u64
Returns the number of closure arguments in a space.
Sourcepub fn function_args_sum(&self) -> u64
pub fn function_args_sum(&self) -> u64
Returns the number of function arguments sum in a space.
Sourcepub fn closure_args_sum(&self) -> u64
pub fn closure_args_sum(&self) -> u64
Returns the number of closure arguments sum in a space.
Sourcepub fn function_args_average(&self) -> f64
pub fn function_args_average(&self) -> f64
Returns the average number of functions arguments in a space.
Sourcepub fn closure_args_average(&self) -> f64
pub fn closure_args_average(&self) -> f64
Returns the average number of closures arguments in a space.
Sourcepub fn total(&self) -> u64
pub fn total(&self) -> u64
Returns the total number of arguments of each function and closure in a space.
Sourcepub fn own_args(&self) -> u64
pub fn own_args(&self) -> u64
Returns this space’s own argument count: its function parameters plus the parameters of any lambda the language folds into it (a lambda that opens no space of its own).
This is the quantity bca check --threshold nargs=N gates on
since #1196, and the one the wire shape serializes as
nargs.value — as opposed to total, which sums
the whole subtree and so charges a function for every nested
callable’s parameters. Named here rather than spelled out at
each call site so the CLI gate, the serialized field, and any
future front-end read one definition instead of three copies of
the same sum (#1236).
Sourcepub fn average(&self) -> f64
pub fn average(&self) -> f64
Returns the NArgs metric average value
This value is computed dividing the NArgs value
for the total number of functions/closures in a space.
Sourcepub fn function_args_min(&self) -> u64
pub fn function_args_min(&self) -> u64
Returns the minimum number of function arguments in a space.
Collapses the usize::MAX sentinel that Stats::default() plants
into fn_nargs_min to 0.0, so a never-observed space
serializes to a meaningful number rather than 1.8446744e19.
Sourcepub fn function_args_max(&self) -> u64
pub fn function_args_max(&self) -> u64
Returns the maximum number of function arguments in a space.
Sourcepub fn closure_args_min(&self) -> u64
pub fn closure_args_min(&self) -> u64
Returns the minimum number of closure arguments in a space.
Same usize::MAX sentinel collapse as function_args_min.
Sourcepub fn closure_args_max(&self) -> u64
pub fn closure_args_max(&self) -> u64
Returns the maximum number of closure arguments in a space.