pub trait ConsoleSink:
Debug
+ Send
+ Sync
+ 'static {
// Required method
fn emit(&self, entry: &ConsoleEntry);
// Provided methods
fn styled_for(&self, _level: ConsoleLevel) -> bool { ... }
fn clear(&self) { ... }
}Expand description
Receiver for console entries as they are produced.
Installed via ConsoleCapture::with_sink / ConsoleOptions::sink
by hosts that want live output instead of a buffer drained at the end.
emit runs on the VM thread inside the console.* call, so it must not
block for long.
Required Methods§
fn emit(&self, entry: &ConsoleEntry)
Provided Methods§
Sourcefn styled_for(&self, _level: ConsoleLevel) -> bool
fn styled_for(&self, _level: ConsoleLevel) -> bool
Whether rendered values may carry ANSI styling. Node colours
util.inspect output only when the stream is a terminal — and log and
error go to different streams, so the answer is per level. A sink
writing to a pipe (and the buffered no-sink path) answers false.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".