pub fn get_function_spaces(
lang: &LANG,
source: Vec<u8>,
path: &Path,
pr: Option<Arc<PreprocResults>>,
) -> Result<FuncSpace, MetricsError>👎Deprecated since 0.0.26:
Use analyze(Source::new(lang, &code).with_name(Some(name)), MetricsOptions::default()) 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.
§Deprecated
Prefer analyze, which accepts a Source carrying an
explicit display name distinct from any on-disk path. This
shim derives FuncSpace::name from path via lossy
UTF-8 conversion and remains for backwards compatibility
for one minor release.
§Examples
use std::path::PathBuf;
use big_code_analysis::{get_function_spaces, LANG};
let source_code = "int a = 42;";
let language = LANG::Cpp;
// The path to a dummy file used to contain the source code
let path = PathBuf::from("foo.c");
let source_as_vec = source_code.as_bytes().to_vec();
get_function_spaces(&language, source_as_vec, &path, None).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.