pub struct FuncSpace {
pub name: Option<String>,
pub start_line: usize,
pub end_line: usize,
pub kind: SpaceKind,
pub spaces: Vec<FuncSpace>,
pub metrics: CodeMetrics,
pub suppressed: SuppressionScope,
}Expand description
Function space data.
Fields§
§name: Option<String>The name of a function space.
For the top-level (file-level) FuncSpace, this is the value
supplied via Source::name to analyze — typically a file
path or other display identifier chosen by the caller. The
library no longer derives this from a &Path or applies lossy
UTF-8 conversion; callers are expected to pass an
already-stringified identifier (or None if they have no
meaningful name to attach). The deprecated entry points
get_function_spaces / [metrics_with_options] continue to
derive a lossy string from the &Path argument for backwards
compatibility.
For nested spaces, None means an error occurred in parsing the
name of the function space from the AST.
start_line: usizeThe first line of a function space
end_line: usizeThe last line of a function space
kind: SpaceKindThe space kind
spaces: Vec<FuncSpace>All subspaces contained in a function space
metrics: CodeMetricsAll metrics of a function space
suppressed: SuppressionScopeIn-source suppression markers that apply to this space.
Populated during the spaces pass from comment-embedded
directives. Each marker carries a SuppressionScope naming
the metrics it silences. The top-level (file-level) FuncSpace
aggregates every file-scoped marker; nested function spaces
aggregate every function-scoped marker whose comment lies
inside their source range. Metric computation itself is
unaffected — this field is consumed by downstream
threshold-check code (e.g. bca check), which consults a
crate::SuppressionPolicy to decide whether to honour the
markers or surface every violation regardless.
Defaults to SuppressionScope::default() (an empty Some), so
pre-existing code paths that do not honor suppressions see no
behaviour change. The field is elided from JSON output when
empty so the existing schema is unchanged for files without
markers.