Skip to main content

UserOutput

Trait UserOutput 

Source
pub trait UserOutput: Send + Sync {
    // Required methods
    fn info(&self, msg: &str);
    fn warn(&self, msg: &str);
    fn error(&self, msg: &str);
    fn assistant_text(&self, text: &str);
    fn tool_call(&self, tool_name: &str, input_preview: &str);
    fn tool_ok(&self);
    fn tool_err(&self, err_msg: &str);

    // Provided method
    fn write_chunk(&self, chunk: &str) { ... }
}
Expand description

Port: emit structured output to the user.

Implementations may render to a terminal, a log file, a TUI widget, or a machine-readable JSON stream.

Required Methods§

Source

fn info(&self, msg: &str)

Source

fn warn(&self, msg: &str)

Source

fn error(&self, msg: &str)

Source

fn assistant_text(&self, text: &str)

Source

fn tool_call(&self, tool_name: &str, input_preview: &str)

Source

fn tool_ok(&self)

Source

fn tool_err(&self, err_msg: &str)

Provided Methods§

Source

fn write_chunk(&self, chunk: &str)

Emit a single streaming chunk of assistant text.

Called once per token/chunk during streaming inference. The default implementation delegates to assistant_text, so existing adapters remain valid until they opt into incremental rendering.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§