StreamingCallback

Trait StreamingCallback 

Source
pub trait StreamingCallback: Send + Sync {
    // Required methods
    fn on_cycle_start(&self, cycle: u32);
    fn on_fact(&self, cycle: u32, fact: &Fact);
    fn on_cycle_end(&self, cycle: u32, facts_added: usize);
}
Expand description

Callback trait for streaming fact emissions during convergence.

Implement this trait to receive real-time notifications as the engine executes. Useful for:

  • Streaming output to CLI/UI
  • Progress monitoring
  • Real-time fact logging

§Thread Safety

Callbacks must be Send + Sync as they may be called from the engine’s execution context. Keep implementations lightweight to avoid blocking the convergence loop.

Required Methods§

Source

fn on_cycle_start(&self, cycle: u32)

Called at the start of each convergence cycle.

Source

fn on_fact(&self, cycle: u32, fact: &Fact)

Called when a fact is added to the context during merge.

Source

fn on_cycle_end(&self, cycle: u32, facts_added: usize)

Called at the end of each convergence cycle.

Implementors§