pub struct ProgressReporter { /* private fields */ }Expand description
Streams human-readable progress lines to stderr while a workflow runs.
Why: A purpose-built reporter (vs. ad-hoc eprintln!s sprinkled in the
engine) keeps the formatting in one place so the terminal output stays
consistent across phases, waves, and failure paths.
What: Stores the workflow start Instant so workflow_done can compute a
total elapsed, plus a use_color flag captured once at construction.
Test: progress_reporter_formats_phase_start,
progress_reporter_formats_phase_done_no_color.
Implementations§
Source§impl ProgressReporter
impl ProgressReporter
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct a reporter, detecting whether stderr is a TTY for color.
Why: Avoid emitting ANSI codes when stderr is piped/captured.
What: Captures Instant::now() and std::io::stderr().is_terminal().
Test: Indirect via formatting tests (force-disable color via with_color).
Sourcepub fn with_color(self, use_color: bool) -> Self
pub fn with_color(self, use_color: bool) -> Self
Force-set the color flag (used by tests for deterministic output).
Sourcepub fn format_phase_start(&self, phase: &str) -> String
pub fn format_phase_start(&self, phase: &str) -> String
Format a phase-start line. Public for testing; production paths call
phase_start which prints to stderr.
Sourcepub fn phase_start(&self, phase: &str)
pub fn phase_start(&self, phase: &str)
Print “phase starting” to stderr.
Sourcepub fn format_phase_done(
&self,
phase: &str,
elapsed: Duration,
cost: f32,
note: Option<&str>,
) -> String
pub fn format_phase_done( &self, phase: &str, elapsed: Duration, cost: f32, note: Option<&str>, ) -> String
Format a phase-done line.
Sourcepub fn phase_done(
&self,
phase: &str,
elapsed: Duration,
cost: f32,
note: Option<&str>,
)
pub fn phase_done( &self, phase: &str, elapsed: Duration, cost: f32, note: Option<&str>, )
Print “phase done” to stderr, with elapsed time and cost.
Sourcepub fn phase_failed(&self, phase: &str, elapsed: Duration, error: &str)
pub fn phase_failed(&self, phase: &str, elapsed: Duration, error: &str)
Print “phase failed” to stderr with elapsed time and a short error.
Sourcepub fn wave_start(
&self,
wave_index: usize,
wave_total: usize,
file_count: usize,
)
pub fn wave_start( &self, wave_index: usize, wave_total: usize, file_count: usize, )
Print a “code wave starting” line for the wave-loop branch of the code phase. The wave loop runs sequentially across multiple files; surfacing per-wave progress prevents the code phase from looking stuck.
Sourcepub fn wave_done(&self, wave_index: usize, wave_total: usize, elapsed: Duration)
pub fn wave_done(&self, wave_index: usize, wave_total: usize, elapsed: Duration)
Print a “code wave done” line. Symmetric counterpart to wave_start.
Sourcepub fn workflow_done(&self, total_elapsed: Duration, total_cost: f32)
pub fn workflow_done(&self, total_elapsed: Duration, total_cost: f32)
Print the final workflow-complete summary line.
Sourcepub fn workflow_started(&self) -> Instant
pub fn workflow_started(&self) -> Instant
Workflow-level start time accessor (used by callers that want to show the wall-clock elapsed alongside per-phase numbers).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ProgressReporter
impl RefUnwindSafe for ProgressReporter
impl Send for ProgressReporter
impl Sync for ProgressReporter
impl Unpin for ProgressReporter
impl UnsafeUnpin for ProgressReporter
impl UnwindSafe for ProgressReporter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more