Skip to main content

Module diag

Module diag 

Source
Expand description

Diagnostics sink for library warnings.

Routes warnings to stderr, or to a TUI pane while a redirect is active.

§Diagnostics Sink

Library code has no injected writer of its own, but it still writes warnings for the user (for example “Holder data requires a Pro API key”). Those warnings go through this module instead of eprintln!.

By default they go to stderr. A full-screen TUI calls redirect so they appear in its output pane instead of over the screen. The binary also gives Stderr to its tracing subscriber, so log lines follow the same route.

scoped gives one future its own sink, over the redirect. The TUI polls a pane command and a watchlist run in one task; each keeps its own warnings (#47).

Structs§

RedirectGuard
Restores the previous diagnostics sink when dropped.
Stderr
A writer that forwards to the active diagnostics sink.

Functions§

notice
Writes one diagnostic line to the active sink.
redirect
Sends diagnostics to sink until the returned guard is dropped.
scoped
Runs fut with its diagnostics in sink, whatever the redirect is.

Type Aliases§

Sink
A shared writer that receives diagnostics while a redirect is active.