pub struct RebuildReporter { /* private fields */ }Expand description
Stateful terminal reporter for rebuild loops.
Tracks whether the previous output was a rolling rebuild line so the
next line can either repaint it (consecutive success) or commit it
with a newline (error, banner). Cheap to construct; not Clone —
instances are typically owned by a single rebuild worker.
When stderr is not a TTY (piped to a logger, captured by tools like
concurrently, or running in CI), the rolling line is replaced with
plain newline-terminated lines so wrappers can flush each rebuild
promptly.
Implementations§
Source§impl RebuildReporter
impl RebuildReporter
Sourcepub fn success(&mut self, elapsed: Duration, triggers: &[PathBuf])
pub fn success(&mut self, elapsed: Duration, triggers: &[PathBuf])
Print a successful rebuild line. In an interactive terminal,
consecutive successes repaint a single line in place; otherwise
each rebuild prints its own newline-terminated line so log
wrappers (concurrently, CI capture, file redirects) flush it.
triggers are the changed paths that caused this rebuild; the line names
the first file (and (+N more) when several changed) so the developer
can see what fired. An empty slice prints no trigger.
Always writes to stderr so it lands on the same stream as the rest of the dev server’s diagnostic output (banners, field tables, errors).
Sourcepub fn error(&mut self, msg: &str)
pub fn error(&mut self, msg: &str)
Print a rebuild error, committing the previous rolling line first so it isn’t overwritten.
Each error block is framed with surrounding blank lines so that consecutive rebuild errors (e.g. repeated saves of a still-broken file) read as separate blocks instead of one squished wall. The leading blank is printed only for the first error in a run; every error prints a trailing blank, so two adjacent errors are separated by exactly one blank line.
Sourcepub fn warnings(&mut self, messages: &[String])
pub fn warnings(&mut self, messages: &[String])
Print non-fatal rebuild advisories, each framed with surrounding blank
lines so they read as distinct blocks (matching error). The leading
blank is printed only when the previous output was not itself a framed
block; every advisory prints a trailing blank.
No-op when messages is empty, so clean rebuilds keep their in-place
rolling line. Each message is the caller’s pre-rendered diagnostic body
(the CLI colorizes per line); the reporter adds the ⚠ build warning:
marker.
Sourcepub fn commit_pending(&mut self)
pub fn commit_pending(&mut self)
Commit any pending rolling rebuild line with a trailing newline, so subsequent unrelated output (banner, info message) doesn’t land on the same line. No-op when not in interactive mode (those lines are already newline-terminated).