Skip to main content

Enhancer

Trait Enhancer 

Source
pub trait Enhancer {
    // Required method
    fn enhance(&self, modules: Vec<ScannedModule>) -> Vec<ScannedModule>;
}
Expand description

Protocol for pluggable metadata enhancement.

§Blocking / async compatibility

enhance is a synchronous method. The bundled AIEnhancer performs blocking HTTP requests via ureq, so each call may park the current thread for up to APCORE_AI_TIMEOUT seconds (default 30) per module. Do not call enhance directly from an async task on a Tokio (or other async) runtime — it will block a runtime worker thread and can stall the scheduler under concurrent load.

From an async context, wrap the call in [tokio::task::spawn_blocking]:

let enhanced = tokio::task::spawn_blocking(move || enhancer.enhance(modules)).await?;

Enhancement is a one-shot scanning-phase operation (not per-request), so this is typically invoked once during framework adapter bootstrap.

Required Methods§

Source

fn enhance(&self, modules: Vec<ScannedModule>) -> Vec<ScannedModule>

Enhance a list of ScannedModules by filling metadata gaps.

Synchronous and potentially long-running. See the trait-level doc comment for guidance on invoking from async contexts.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§