Skip to main content

render_output

Function render_output 

Source
pub fn render_output(output: &OutputResult, settings: &RenderSettings) -> String
Expand description

Renders a structured output result using the configured output format.

ยงExamples

use osp_cli::core::output::OutputFormat;
use osp_cli::core::output_model::OutputResult;
use osp_cli::row;
use osp_cli::ui::{RenderSettings, render_output};

let output = OutputResult::from_rows(vec![row! { "uid" => "alice" }]);
let rendered = render_output(&output, &RenderSettings::test_plain(OutputFormat::Table));

assert!(rendered.contains("uid"));
assert!(rendered.contains("alice"));