pub trait Parser {
// Required method
fn parse(&self, path: &Path, source: &str) -> Result<ProjectFile, ScanError>;
}Expand description
Common trait for all language parsers.
Implementations extract imports, exports, functions, types, and
language-specific IR from source code. Content hashing is handled
by the shared parse_file function — parsers should not
compute the hash themselves.
Required Methods§
Sourcefn parse(&self, path: &Path, source: &str) -> Result<ProjectFile, ScanError>
fn parse(&self, path: &Path, source: &str) -> Result<ProjectFile, ScanError>
Parse source code at path into a ProjectFile.
The content_hash field on the returned ProjectFile may be left
empty; parse_file will overwrite it with the SHA-256 hash.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".