Skip to main content

ProgressReporter

Struct ProgressReporter 

Source
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

Source

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).

Source

pub fn with_color(self, use_color: bool) -> Self

Force-set the color flag (used by tests for deterministic output).

Source

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.

Source

pub fn phase_start(&self, phase: &str)

Print “phase starting” to stderr.

Source

pub fn format_phase_done( &self, phase: &str, elapsed: Duration, cost: f32, note: Option<&str>, ) -> String

Format a phase-done line.

Source

pub fn phase_done( &self, phase: &str, elapsed: Duration, cost: f32, note: Option<&str>, )

Print “phase done” to stderr, with elapsed time and cost.

Source

pub fn phase_failed(&self, phase: &str, elapsed: Duration, error: &str)

Print “phase failed” to stderr with elapsed time and a short error.

Source

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.

Source

pub fn wave_done(&self, wave_index: usize, wave_total: usize, elapsed: Duration)

Print a “code wave done” line. Symmetric counterpart to wave_start.

Source

pub fn workflow_done(&self, total_elapsed: Duration, total_cost: f32)

Print the final workflow-complete summary line.

Source

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§

Source§

impl Default for ProgressReporter

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more