pub fn extract_semantic_units_from_str(
content: &str,
path: &Path,
) -> Result<Vec<SemanticUnit>, AppError>Expand description
Extracts semantic units from Rust source code string
§Arguments
content- Rust source code as stringpath- Path for error reporting
§Returns
Vector of semantic units or error
§Errors
Returns error if code cannot be parsed
§Examples
use std::path::Path;
use rust_diff_analyzer::analysis::extractor::extract_semantic_units_from_str;
let code = "fn main() {}";
let units = extract_semantic_units_from_str(code, Path::new("main.rs")).unwrap();
assert_eq!(units.len(), 1);