pub fn get_function_spaces_with_options(
lang: &LANG,
source: Vec<u8>,
path: &Path,
pr: Option<Arc<PreprocResults>>,
options: MetricsOptions,
) -> Result<FuncSpace, MetricsError>Use analyze(Source::new(lang, &code).with_name(Some(name)), options) instead — the path-positional shim derives the top-level FuncSpace name via lossy UTF-8 conversion.
Expand description
Returns all function spaces data of a code, applying the
per-traversal flags in options (e.g.
exclude_tests: true to elide Rust #[cfg(test)] /
#[test] subtrees from every metric). Equivalent to
get_function_spaces when options is the default.
§Deprecated
Prefer analyze, which accepts a Source carrying an
explicit display name distinct from any on-disk path.
§Examples
use std::path::PathBuf;
use big_code_analysis::{get_function_spaces_with_options, LANG, MetricsOptions};
let source_code = "fn main() {}\n#[test] fn t() {}";
let language = LANG::Rust;
let path = PathBuf::from("foo.rs");
let source_as_vec = source_code.as_bytes().to_vec();
let options = MetricsOptions::default().with_exclude_tests(true);
get_function_spaces_with_options(&language, source_as_vec, &path, None, options).unwrap();§Errors
Returns MetricsError::LanguageDisabled when lang’s
per-language Cargo feature is not enabled in this build.
The return type also carries MetricsError::EmptyRoot
for forward compatibility, but the walker does not produce
it today — see the variant doc.