Skip to main content

run_effect

Function run_effect 

Source
pub fn run_effect<T: Send + 'static>(
    effect: AnalysisEffect<T>,
    config: DebtmapConfig,
) -> Result<T>
Expand description

Run an effect and convert the result to anyhow::Result for backwards compatibility.

This function bridges the new effect system with existing code that uses anyhow::Result. Use this at the boundaries of your code where you need to integrate with existing APIs.

Note: This uses tokio’s block_on to run the async effect synchronously. For better performance in async contexts, use run_effect_async instead.

§Example

// Old code using anyhow
fn old_api() -> anyhow::Result<Metrics> {
    let config = DebtmapConfig::default();
    run_effect(analyze_effect(), config)
}