Function format_with_options

Source
pub fn format_with_options(
    plan: &Plan,
    options: &OutputOptions,
) -> (String, Vec<FormatError>)
Expand description

Format a Substrait plan with custom options.

This function allows you to customize the formatting behavior, such as showing more or less detail, changing indentation, or controlling type visibility.

§Example

use substrait_explain::{parse, format_with_options, OutputOptions, Visibility};

let plan = parse(r#"
=== Plan
Root[result]
  Project[$0, 42]
    Read[data => a:i64]
"#).unwrap();

// Use verbose formatting
let verbose_options = OutputOptions::verbose();
let (text, _errors) = format_with_options(&plan, &verbose_options);
println!("Verbose output:\n{}", text);

// Custom options
let custom_options = OutputOptions {
    literal_types: Visibility::Always,
    indent: "    ".to_string(),
    ..OutputOptions::default()
};
let (text, _errors) = format_with_options(&plan, &custom_options);
println!("Custom output:\n{}", text);

§Options

See OutputOptions for all available configuration options.