codegraph_rust/
lib.rs

1//! # codegraph-rust
2//!
3//! Rust parser for CodeGraph - extracts code entities and relationships from Rust source files.
4//!
5//! ## Features
6//!
7//! - Parse Rust source files and extract functions, structs, enums, traits, and modules
8//! - Track relationships (function calls, use statements, trait implementations)
9//! - Support for Rust-specific constructs (impl blocks, associated functions, generics)
10//! - Configurable behavior via ParserConfig
11//! - Full integration with codegraph-parser-api
12//!
13//! ## Quick Start
14//!
15//! ```rust,no_run
16//! use codegraph_rust::RustParser;
17//! use codegraph_parser_api::CodeParser;
18//! use codegraph::CodeGraph;
19//! use std::path::Path;
20//!
21//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
22//! let mut graph = CodeGraph::in_memory()?;
23//! let parser = RustParser::new();
24//!
25//! let file_info = parser.parse_file(Path::new("src/main.rs"), &mut graph)?;
26//! println!("Parsed {} functions", file_info.functions.len());
27//! # Ok(())
28//! # }
29//! ```
30
31mod extractor;
32mod mapper;
33mod parser_impl;
34mod visitor;
35
36// Re-export parser-api types for convenience
37pub use codegraph_parser_api::{
38    CodeParser, FileInfo, ParserConfig, ParserError, ParserMetrics, ProjectInfo,
39};
40
41// Export the Rust parser implementation
42pub use parser_impl::RustParser;