Skip to main content

Render

Trait Render 

Source
pub trait Render: Serialize {
    // Required method
    fn render_table(&self, w: &mut dyn Write, ctx: &OutputCtx) -> Result<()>;

    // Provided method
    fn toon_projection(&self) -> Option<Value> { ... }
}
Expand description

Trait every printable response implements.

Required Methods§

Source

fn render_table(&self, w: &mut dyn Write, ctx: &OutputCtx) -> Result<()>

Render a human-facing representation to w. Implementations should use new_table (which picks the right preset for the current ctx.format) for tabular data so markdown and table formats share one code path.

Provided Methods§

Source

fn toon_projection(&self) -> Option<Value>

Override only when the default Serialize shape produces TOON output that can’t tabularize — typically a Vec<struct> field on each row of a list response. The returned serde_json::Value is used only for TOON encoding (JSON/YAML stay lossless via the default Serialize impl).

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Render for EnabledCountResponse

Source§

fn render_table(&self, w: &mut dyn Write, _ctx: &OutputCtx) -> Result<()>

Source§

impl Render for GetSetResponse

Source§

fn render_table(&self, w: &mut dyn Write, _ctx: &OutputCtx) -> Result<()>

Source§

impl Render for ListContainsItemResponse

Source§

fn render_table(&self, w: &mut dyn Write, _ctx: &OutputCtx) -> Result<()>

Source§

impl Render for WebhookEnabledCountResponse

Source§

fn render_table(&self, w: &mut dyn Write, _ctx: &OutputCtx) -> Result<()>

Implementors§