1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright 2024-2026 Jonathan Shook
// SPDX-License-Identifier: Apache-2.0
//! [`ReadoutBuf`] — the surface-supplied output buffer.
//!
//! Push 1 only needs the [`String`]-backed buffer that the
//! terminal-mode log path uses (ANSI escape sequences land
//! inline as text). Later pushes will add a `Vec<Span>`-backed
//! buffer for the TUI surface; the [`ReadoutBuf`] trait is
//! the single write surface a [`Readout`](crate::Readout)
//! impl sees regardless of which backing store is in use.
use ;
/// Append-only write surface a readout writes its rendered
/// piece into. Implementations decide how to handle styling
/// (ANSI inline vs. typed style runs) and ANSI stripping
/// (TTY vs. non-TTY sinks).
///
/// The trait is intentionally minimal — `write_str` is
/// enough for the Push 1 built-in. Later pushes will extend
/// it with style-run pushes (`push_styled`) once the colour
/// / style sub-language lands; until then, readouts emit
/// ANSI escapes as part of `write_str` payloads when they
/// want styling, and the buffer's own ANSI policy decides
/// whether to keep or strip.
/// `String`-backed buffer. Used by the terminal-mode log
/// surface, which routes through `nmbrs-runtime::observer::log`
/// and ultimately `eprint!`. ANSI escape sequences pass
/// through unchanged; the surface above strips them when the
/// destination is a non-TTY pipe.
/// Convenience: render a readout into a freshly allocated
/// `String`. Used by the in-process tests and the
/// `crate::diag!` bridge in Push 1; later pushes will route
/// directly through a borrowed buffer instead.