Skip to main content

export_analyzer

Macro export_analyzer 

Source
macro_rules! export_analyzer {
    ($analyzer_type:ty) => { ... };
}
Expand description

Export an analyzer as a WASM plugin.

This macro generates the required WASM export functions:

  • crawlkit_plugin_init
  • crawlkit_plugin_analyze
  • crawlkit_plugin_free_string

ยงExample

use crawlkit_plugin_sdk::{Analyzer, Finding, Severity, AnalysisContext};

pub struct MyAnalyzer;
impl MyAnalyzer { pub fn new() -> Self { Self } }
impl Default for MyAnalyzer { fn default() -> Self { Self::new() } }

impl Analyzer for MyAnalyzer {
    fn name(&self) -> &str { "my-analyzer" }
    fn analyze(&self, _ctx: &AnalysisContext) -> Vec<Finding> { vec![] }
}

crawlkit_plugin_sdk::export_analyzer!(MyAnalyzer);