nmbrs_runtime/readouts.rs
1// Copyright 2024-2026 Jonathan Shook
2// SPDX-License-Identifier: Apache-2.0
3
4//! Readout engine — see `docs/SRD/63_status_readouts.md`.
5//!
6//! The engine provides:
7//!
8//! - The [`Readout`] trait + [`Lod`] / [`ContentMode`] enums.
9//! - The minimum [`ReadoutContext`] surface needed by the
10//! `phase_outcome` built-in. Methods that future built-ins
11//! will need are added in later pushes as needed.
12//! - One built-in: [`builtins::phase_outcome`] at
13//! `Lod::Labeled` / `ContentMode::Value`. Other LODs and
14//! the explanation-overlay mode render zero bytes until
15//! later pushes fill them in.
16//! - A small static registry to look up readouts by name.
17//!
18//! Lives as a module under `nmbrs-runtime` rather than its
19//! own crate: the trait surface and built-ins read from
20//! data sources owned here (`ActivityMetrics`, the scene
21//! tree, the live-status pipeline), and `nmbrs-tui` already
22//! depends on `nmbrs-runtime` so a separate crate would
23//! either re-export those types upward or cyclic-depend.
24//! The clean split was a fiction; the module organisation
25//! gives the same conceptual boundary without the build-graph
26//! cost.
27
28pub mod binder;
29pub mod buf;
30pub mod color;
31pub mod context;
32pub mod format;
33pub mod parse;
34pub mod readout;
35pub mod registry;
36pub mod snapshot;
37
38pub mod builtins;
39
40pub use binder::{
41 BakedBody, BinderKey, DefaultBinder, LayoutHint, LayoutMode, ReadoutBinder, ReadoutHandle,
42 ReadoutSink, RenderStep, StringSink, TuiReadoutBinder, build_binder_from_workload,
43 build_event_binder, build_event_binder_with_cli, validate_body_for_event,
44};
45pub use buf::ReadoutBuf;
46pub use context::{LifecycleState, ReadoutContext};
47pub use readout::{ContentMode, Lod, OptionTypeMismatch, OptionValue, Readout, ReadoutOptions};
48pub use registry::Registry;