pub struct LiveTreeRenderer { /* private fields */ }Expand description
EventSink that re-renders the cascade tree to stdout in place every
RoundCompleted (and Finished). Uses ANSI cursor positioning so
the tree fills in line-by-line as the cascade unfolds — same idiom
nix-output-monitor (nom) uses.
Usage: hand to Cascade::new()...events(&renderer).run() for default
“watch the cascade unfold” behavior in any TTY-attached cli bin.
Caller is responsible for not wiring this when stdout is a pipe — it
would emit ANSI escapes into the captured output. crate::output
handles the TTY check.
Implementations§
Source§impl LiveTreeRenderer
impl LiveTreeRenderer
pub fn new(color: bool, max_depth: Option<usize>) -> Self
Sourcepub fn with_max_height(self, h: Option<usize>) -> Self
pub fn with_max_height(self, h: Option<usize>) -> Self
Builder: set an explicit maximum frame height (lines). Used for tests
that can’t rely on a real terminal. Some(0) disables height capping.
In production the height is auto-detected from the terminal on each
paint via console::Term::stdout().size().
Sourcepub fn with_header_text(self, text: impl Into<String>) -> Self
pub fn with_header_text(self, text: impl Into<String>) -> Self
Builder: replace the default "Cascade deploy" header with a
single custom line.
Sourcepub fn with_header_lines(self, lines: Vec<String>) -> Self
pub fn with_header_lines(self, lines: Vec<String>) -> Self
Builder: provide multiple header lines. The first renders with
┏━ (top-left), each subsequent line renders with ┣
(T-junction) — matches nom’s section convention. Use to keep
a wide header readable on narrow terminals without truncation:
LiveTreeRenderer::new(color, max_depth)
.with_header_lines(vec![
format!("Strategy: {} || Nodes: {}", name, n),
format!("Fanout: {} || Failures: {}%", f, fr),
])