Skip to main content

OutputFormatter

Trait OutputFormatter 

Source
pub trait OutputFormatter: Serialize + JsonSchema {
    // Required method
    fn format_text(&self) -> String;

    // Provided method
    fn format_pretty(&self) -> String { ... }
}
Expand description

Trait for types that can format output in multiple formats.

Types implementing this trait provide text formatting. JSON/jq/jsonl output is handled automatically by server-less via Serialize.

Required Methods§

Source

fn format_text(&self) -> String

Format as minimal text (LLM-optimized, default).

Provided Methods§

Source

fn format_pretty(&self) -> String

Format as pretty text (human-friendly with colors). Default implementation falls back to format_text().

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§