pub struct SemanticExtractor;Expand description
Canonical API for detailed semantic analysis of source code.
Implementations§
Source§impl SemanticExtractor
impl SemanticExtractor
Sourcepub fn extract(
source: &str,
language: &str,
ast_recursion_limit: Option<usize>,
timeout_micros: Option<u64>,
) -> Result<SemanticAnalysis, ParserError>
pub fn extract( source: &str, language: &str, ast_recursion_limit: Option<usize>, timeout_micros: Option<u64>, ) -> Result<SemanticAnalysis, ParserError>
Extract detailed semantic information from source code.
This is the main entry point for comprehensive semantic analysis. It extracts:
- Function and class definitions
- Function calls and call frequency
- Import statements
- Type references
- Impl trait blocks (Rust only)
§Arguments
source- The source code as a stringlanguage- The programming language (e.g., “rust”, “python”)ast_recursion_limit- Optional AST recursion depth limit (0 = unlimited)timeout_micros- Optional timeout in microseconds
§Returns
A SemanticAnalysis containing all extracted semantic information.
§Errors
Returns a ParserError if:
ParserError::Timeout- The operation exceeds the specified timeoutParserError::UnsupportedLanguage- The language is not supportedParserError::ParseError- Tree-sitter parsing fails
Sourcepub fn extract_module_info(
source: &str,
language: &str,
timeout_micros: Option<u64>,
) -> Result<ModuleInfo, ParserError>
pub fn extract_module_info( source: &str, language: &str, timeout_micros: Option<u64>, ) -> Result<ModuleInfo, ParserError>
Fast path for extracting module metadata: functions and imports only.
This method is optimized for the analyze_module tool, which only needs function
definitions and import statements. It skips the more expensive extractors (calls,
references, impl traits) and returns a lightweight ModuleInfo directly.
§Arguments
source- The source code as a stringlanguage- The programming language (e.g., “rust”, “python”)timeout- Optional timeout configuration in microseconds
§Returns
A ModuleInfo containing the file name, line count, language, functions, and imports.
§Errors
Returns a ParserError if:
ParserError::Timeout- The operation exceeds the specified timeoutParserError::UnsupportedLanguage- The language is not supportedParserError::ParseError- Tree-sitter parsing fails
Auto Trait Implementations§
impl Freeze for SemanticExtractor
impl RefUnwindSafe for SemanticExtractor
impl Send for SemanticExtractor
impl Sync for SemanticExtractor
impl Unpin for SemanticExtractor
impl UnsafeUnpin for SemanticExtractor
impl UnwindSafe for SemanticExtractor
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 more