Parse a Rust file and return the AST
(path: &Path)
| 6 | |
| 7 | /// Parse a Rust file and return the AST |
| 8 | pub fn parse_rust_file(path: &Path) -> Result<syn::File> { |
| 9 | let content = fs::read_to_string(path) |
| 10 | .with_context(|| format!("Failed to read file {}", path.display()))?; |
| 11 | |
| 12 | parse_rust_code(&content).with_context(|| format!("Failed to parse file {}", path.display())) |
| 13 | } |
| 14 | |
| 15 | /// Parse a string of Rust code and return the AST |
| 16 | pub fn parse_rust_code(content: &str) -> Result<syn::File> { |
no test coverage detected