Parse a string of Rust code and return the AST
(content: &str)
| 14 | |
| 15 | /// Parse a string of Rust code and return the AST |
| 16 | pub fn parse_rust_code(content: &str) -> Result<syn::File> { |
| 17 | syn::parse_str::<syn::File>(content) |
| 18 | .map_err(|e| anyhow::anyhow!("Failed to parse Rust code: {}", e)) |
| 19 | } |
| 20 | |
| 21 | /// Process a directory and return a vector of (path, AST) pairs |
| 22 | pub fn process_directory(dir_path: &Path) -> Vec<(PathBuf, syn::File)> { |