ptx_parser/pretty_print/tree_display.rs
1use super::TreeFormatter;
2/// Trait for displaying AST nodes in a tree structure.
3///
4/// Types implementing this trait can be displayed as a tree with proper
5/// indentation and box-drawing characters, showing both their structure
6/// and the original source text.
7use std::fmt;
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}