Skip to main content

App

Struct App 

Source
pub struct App {
    pub should_quit: bool,
    pub should_exit_process: bool,
    pub yielded_to_terminal: bool,
    pub external_quit: Arc<AtomicBool>,
    pub tick_rate: Duration,
    pub show_log: bool,
    pub log_level_filter: LogSeverity,
    /* private fields */
}
Expand description

TUI application.

Fields§

§should_quit: bool§should_exit_process: bool

If true, the entire nmbrs process should exit after the TUI cleans up its terminal state. Set by triple-tapping q.

§yielded_to_terminal: bool

Set when the user pressed Ctrl-T inside the TUI to hand the terminal back to line-mode (tui=terminal) display. The sink supervisor reads this on the App thread’s join to decide whether to bring LogOnlySink back up (true — toggle) or treat the run as fully complete (false — natural exit / Ctrl-C / triple-q). Public so the supervisor can read after App::run() returns.

§external_quit: Arc<AtomicBool>

External-quit hook the sink supervisor sets when it wants to pull the TUI down without a user keystroke (e.g. the run completed and the supervisor is shutting down all sinks). The event loop polls this each iteration alongside the existing should_quit flag.

§tick_rate: Duration§show_log: bool

Whether the log panel is visible (toggled with l key).

§log_level_filter: LogSeverity

Minimum severity rendered in the log panel. Defaults to Info so high-cadence Debug instrumentation (per-fiber-exit, cadence-ingest tracing) doesn’t drown the signal. Cycled by the D key: Info → Debug → Warn → Error → Info.

Implementations§

Source§

impl App

Source

pub fn new( frame_rx: Receiver<MetricSet>, run_state: RunStateHandle, metrics_query: Arc<MetricsQuery>, ) -> Self

Create with a metrics channel and a RunStateHandle (snapshot reader + command sender — see SRD-02 §“Display and Diagnostic Decoupling”).

Source

pub fn edit_prompt(&self) -> Option<&ControlEditPrompt>

Borrow the current control-edit prompt (if visible). Widgets use this to render the inline prompt bar.

Source

pub fn is_editing(&self) -> bool

Whether the TUI is currently in edit mode. Event loops in edit mode route character input to the prompt buffer instead of navigation.

Source

pub fn open_control_edit_prompt(&mut self)

Open the inline control-edit prompt. The prompt accepts name=value text; submit via Self::submit_control_edit.

Source

pub fn close_control_edit_prompt(&mut self)

Close the prompt without submitting.

Source

pub fn edit_push_char(&mut self, c: char)

Append a character to the edit buffer. No-op when not in edit mode.

Source

pub fn edit_pop_char(&mut self)

Remove the last character from the edit buffer.

Source

pub fn submit_control_edit(&mut self) -> Option<(String, f64)>

Submit the current edit buffer. Parses name=value, dispatches a non-blocking set_f64 against the named control through the session-root globals installed by the runner. Records the outcome on the prompt for inline display.

Returns the parsed (name, value) on successful dispatch so tests can assert.

Source

pub fn set_tree_lod_label(&mut self, label: &str)

Set the tree LOD directly. Production code changes LOD through left/right arrow keybinds via Self::adjust_tree_lod; tests use this helper to render a specific view without routing a synthetic key event.

Accepted labels match TreeLod::label: "off", "phase", "min", "focus", "def", "max". Unknown labels leave the current LOD unchanged.

Source

pub fn run(&mut self) -> Result<()>

Run the TUI event loop. Blocks until quit or run completes.

Terminal cleanup is guaranteed across every exit path — normal return, propagated ? error, and panic — via a TerminalGuard (Drop-based) and a panic hook installed for the duration of the run. Either mechanism restores raw mode, leaves the alternate screen, and disables mouse capture before control returns to the shell.

The event loop also intercepts Ctrl+C as a distinct signal from q. Ctrl+C tears the TUI down and then raises SIGINT to the current process so the signal propagates through any runtime handlers the rest of the process has installed (tokio ctrl_c, shell-level exit codes, etc.) with standard interrupt semantics.

Source

pub fn draw(&self, frame: &mut Frame<'_>)

Render one frame. Public for testing with TestBackend.

While paused, every read routes through the snapshot clone in self.frozen_state instead of the live state. Live observer updates keep flowing into self.run_state — they just don’t affect the rendered frame until the user resumes.

Source

pub fn cycle_readout_focus_next(&mut self)

Cycle focus forward through the readouts bound to the most-recently-fired event slot. Public for the Tab keybind. No-op when the binder hasn’t fired yet (no slot context).

Source

pub fn cycle_readout_focus_prev(&mut self)

Cycle focus backward through the most-recent slot’s readouts. Bound to Shift-Tab.

Source

pub fn cycle_readout_lod_up(&mut self)

Cycle the focused readout’s LOD up (compact → labeled → expanded → compact). Bound to +. No-op when no readout is focused.

Source

pub fn cycle_readout_lod_down(&mut self)

Cycle the focused readout’s LOD down. Bound to -.

Source

pub fn toggle_readout_overlay(&mut self)

Toggle the explanation-overlay flag. While set, every readout fire emits ContentMode::Explanation instead of Value. Bound to \. The held-key semantics from SRD-63 are approximated as a press-toggle because crossterm’s standard polling doesn’t surface key- release reliably.

Source

pub fn readout_overlay_active(&self) -> bool

Whether the explanation overlay is currently active. Surface code (footer, panel render path) reads this to render an indicator and to pass the right ContentMode when firing the binder.

Auto Trait Implementations§

§

impl !Freeze for App

§

impl !RefUnwindSafe for App

§

impl !Sync for App

§

impl !UnwindSafe for App

§

impl Forget for App

§

impl Move for App

§

impl Send for App

§

impl Unpin for App

§

impl UnsafeUnpin for App

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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