pub trait CommandResponse: Serialize {
// Required methods
fn command_name(&self) -> &'static str;
fn human_readable(&self) -> String;
// Provided methods
fn to_json_output(&self) -> String { ... }
fn to_json_output_pretty(&self) -> String { ... }
}Expand description
Trait for command responses that can be rendered in multiple formats
Required Methods§
Sourcefn command_name(&self) -> &'static str
fn command_name(&self) -> &'static str
The command name for the response envelope
Sourcefn human_readable(&self) -> String
fn human_readable(&self) -> String
Render as human-readable text
Provided Methods§
Sourcefn to_json_output(&self) -> String
fn to_json_output(&self) -> String
Render as JSON (default implementation via serde).
Output is compact (single line, no extra whitespace) by default — this
is the agent-first, token-efficient representation and is also valid
JSONL. Use CommandResponse::to_json_output_pretty for human-readable
indented JSON.
Sourcefn to_json_output_pretty(&self) -> String
fn to_json_output_pretty(&self) -> String
Render as indented, human-readable JSON (opt-in via --pretty).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".