Function rust_code_analysis::metrics [−][src]
Expand description
Returns all function spaces data of a code. This function needs a parser to be created a priori in order to work.
Examples
use std::path::Path;
use rust_code_analysis::{CppParser, metrics, ParserTrait};
let source_code = "int a = 42;";
// The path to a dummy file used to contain the source code
let path = Path::new("foo.c");
let source_as_vec = source_code.as_bytes().to_vec();
// The parser of the code, in this case a CPP parser
let parser = CppParser::new(source_as_vec, &path, None);
// Gets all function spaces data of the code contained in foo.c
metrics(&parser, &path).unwrap();