use super::metrics::RUST_UNIFIED_CACHE;
use crate::services::unified_rust_analyzer::UnifiedRustAnalyzer;
pub async fn analyze_rust_language(
file_path: &std::path::Path,
) -> anyhow::Result<Vec<crate::services::context::AstItem>> {
let analyzer = UnifiedRustAnalyzer::new(file_path.to_path_buf());
let analysis = analyzer
.analyze()
.await
.map_err(|e| anyhow::anyhow!("Unified Rust analysis failed: {}", e))?;
RUST_UNIFIED_CACHE.insert(file_path.to_path_buf(), analysis.file_metrics.clone());
Ok(analysis.ast_items)
}
#[allow(dead_code)]
pub(super) async fn analyze_rust_file(
file_path: &std::path::Path,
) -> anyhow::Result<Vec<crate::services::context::AstItem>> {
use crate::services::ast_rust::analyze_rust_file as analyze_rust;
match analyze_rust(file_path).await {
Ok(file_context) => Ok(file_context.items),
Err(_) => Ok(Vec::new()), }
}