Skip to main content

format_tree

Function format_tree 

Source
pub fn format_tree(value: &ValueRef<'_>) -> String
Expand description

Format an inspected value as a tree with automatic terminal color detection.

If stdout is a TTY and environment variables allow it, semantic colors are applied. If output is redirected to a file or pipe, colors are automatically omitted.

ยงExample

use inspect_rs::{Inspect, InspectCx, format_tree};

let value = vec![1, 2, 3];
let mut cx = InspectCx::new();
let inspected = value.inspect(&mut cx);

println!("{}", format_tree(&inspected));