ptx_parser/pretty_print/tree_display.rs
1/// Trait for displaying AST nodes in a tree structure.
2///
3/// Types implementing this trait can be displayed as a tree with proper
4/// indentation and box-drawing characters, showing both their structure
5/// and the original source text.
6use std::fmt;
7use super::TreeFormatter;
8
9pub trait TreeDisplay {
10 /// Display this node in tree format.
11 ///
12 /// # Arguments
13 /// * `f` - The formatter to write to
14 /// * `source` - The original source code string for extracting raw text from spans
15 fn tree_display(&self, f: &mut TreeFormatter, source: &str) -> fmt::Result;
16}