pub struct AstExtractor;Expand description
Extracts AST information from source files.
Uses tree-sitter queries for efficient pattern matching and delegates to language-specific implementations for detailed extraction.
Implementations§
Source§impl AstExtractor
impl AstExtractor
Sourcepub fn extract_file(path: &Path) -> Result<ModuleInfo>
pub fn extract_file(path: &Path) -> Result<ModuleInfo>
Extract full module info from a file.
This is the main entry point for AST extraction. It:
- Detects the language from file extension
- Parses the file with tree-sitter
- Extracts functions, classes, and imports
- Returns a complete ModuleInfo structure
§Arguments
path- Path to the source file
§Returns
Result<ModuleInfo>- Extracted module information or error
§Errors
BrrrError::UnsupportedLanguage- File extension not recognizedBrrrError::Io- File could not be readBrrrError::Parse- File could not be parsed
Sourcepub fn extract_from_source(source: &str, language: &str) -> Result<ModuleInfo>
pub fn extract_from_source(source: &str, language: &str) -> Result<ModuleInfo>
Extract functions and classes from source code string.
Convenience method for extracting from in-memory source code when the language is already known.
§Arguments
source- Source code as stringlanguage- Language name (e.g., “python”, “typescript”)
§Returns
Result<ModuleInfo>- Extracted module information
Sourcepub fn find_function(path: &Path, function_name: &str) -> Result<FunctionInfo>
pub fn find_function(path: &Path, function_name: &str) -> Result<FunctionInfo>
Auto Trait Implementations§
impl Freeze for AstExtractor
impl RefUnwindSafe for AstExtractor
impl Send for AstExtractor
impl Sync for AstExtractor
impl Unpin for AstExtractor
impl UnwindSafe for AstExtractor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request