Skip to main content

Module captured_output

Module captured_output 

Source
Expand description

Where program output and error reports go.

By default they go to the process’s stdout and stderr. A host that embeds the runtime can redirect both into a per-thread buffer instead, run some candela code, and read the buffer back. Redirection is a runtime setting, so a single build serves both the command-line toolchain and an embedding host. wasm builds always redirect, since there are no process streams to write to.

A stream that refuses a write costs the text, never the run: write through [out!] and [outln!] rather than unwrapping.

Enums§

OutputHandle
A writer that resolves to a process stream or to the capture buffer, whichever is in effect when it is created.

Constants§

CAPTURED_OUTPUT

Functions§

is_capturing
Whether output on this thread is redirected into CAPTURED_OUTPUT.
print
Appends to this thread’s capture buffer, whether or not redirection is on.
set_capturing
Starts or stops redirecting output on this thread, and returns the setting that was in effect, so a caller can put it back.
stderr
The sink for error reports.
stdout
The sink for program output (print and friends).