Skip to main content

codetether_rlm/events/
progress.rs

1//! RLM progress event.
2
3use serde::{Deserialize, Serialize};
4use uuid::Uuid;
5
6/// Progress tick from an in-flight RLM analysis loop.
7#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct RlmProgressEvent {
9    pub trace_id: Uuid,
10    pub iteration: usize,
11    pub max_iterations: usize,
12    pub status: String,
13}
14
15impl RlmProgressEvent {
16    /// Fraction of iteration budget consumed (0.0–1.0).
17    pub fn fraction(&self) -> f64 {
18        if self.max_iterations == 0 {
19            0.0
20        } else {
21            (self.iteration as f64 / self.max_iterations as f64).clamp(0.0, 1.0)
22        }
23    }
24}