Skip to main content

Module warnings

Module warnings 

Source
Expand description

Framework warning collection and deferred rendering.

Some parts of standout-render (notably the embedded-resource hot-reload path in [crate::embedded]) can encounter non-fatal problems during application startup — e.g. a stylesheet fails to parse and the framework silently falls back to the compile-time embedded copy. Historically these were emitted via eprintln! during initialization, which meant they printed before the command’s own output and as plain text, even when rendering into a rich terminal.

This module routes those messages through a process-local collector so the CLI layer can render them after the command output, styled through the active theme, with a clear banner separating them from the rest of the terminal session.

§Scope

Only framework warnings (problems with standout’s own setup / resource loading) should go through this module. User-facing diagnostics that are part of a handler’s legitimate output — clipboard access failures, input validation feedback, handler-generated I/O errors — stay on stderr as before; interleaving them with other output is the correct behavior.

§Usage

Inside the framework, call push_warning instead of eprintln!:

use standout_render::warnings::push_warning;
push_warning(format!("Failed to parse stylesheets from '{}': {}", path, err));

The CLI layer drains the collector at the end of App::run and renders the batch through the theme; see the standout crate for the flush logic.

Constants§

WARNING_BANNER_STYLE
Style name for the “Standout :: Warnings” banner, looked up in the theme.
WARNING_ITEM_STYLE
Style name for each individual warning line, looked up in the theme.

Functions§

drain_warnings
Removes and returns all collected warnings for the current thread.
flush_to_stderr
Drains the collector and emits the warnings to stderr.
has_warnings
Returns true if any warnings are currently buffered for this thread.
push_warning
Appends a framework warning to the thread-local collector.