Skip to main content

ProgramHook

Trait ProgramHook 

Source
pub trait ProgramHook: Provider {
    // Provided methods
    fn before_program(
        &self,
        _file: &File,
        _program: &Program<'_>,
        _context: &mut HookContext<'_, '_>,
    ) -> HookResult<HookAction> { ... }
    fn after_program(
        &self,
        _file: &File,
        _program: &Program<'_>,
        _context: &mut HookContext<'_, '_>,
    ) -> HookResult<()> { ... }
}
Expand description

Hook trait for intercepting program-level analysis.

This hook is called before and after analyzing a complete program (file). It receives the source file, full AST, and mutable context, allowing hooks to:

  • Access file information (id, path, content)
  • Inspect the entire program structure
  • Report issues at the program level
  • Pre-register variables before analysis
  • Skip analysis entirely

Provided Methods§

Source

fn before_program( &self, _file: &File, _program: &Program<'_>, _context: &mut HookContext<'_, '_>, ) -> HookResult<HookAction>

Called before a program is analyzed.

Return HookAction::Continue to proceed with normal analysis, or HookAction::Skip to skip analysis of this program entirely.

Source

fn after_program( &self, _file: &File, _program: &Program<'_>, _context: &mut HookContext<'_, '_>, ) -> HookResult<()>

Called after a program has been analyzed.

Implementors§