pub struct PrintConfig {
pub format: PrintFormat,
pub include_snippets: bool,
pub include_line_info: bool,
pub snippet_col_width: usize,
pub snippet_max_length: usize,
pub max_depth: usize,
pub indent_width: usize,
pub include_node_ids: bool,
pub include_field_names: bool,
pub line_width_limit: usize,
}Expand description
Production-ready configuration for rendering and printing
This struct controls all aspects of output formatting. Use the builder
methods to customize behavior, or use preset configurations via
PrintConfig::minimal() and PrintConfig::verbose().
Fields§
§format: PrintFormatOutput format (tree, compact, flat)
include_snippets: boolInclude source code snippets in output
include_line_info: boolInclude line number information [start-end]
snippet_col_width: usizeColumn width for snippet alignment (for tree format)
snippet_max_length: usizeMaximum snippet length before truncation with “…”
max_depth: usizeMaximum nesting depth (prevents stack overflow on deeply nested input)
indent_width: usizeIndentation width in spaces per nesting level
include_node_ids: boolInclude unique node IDs in output
include_field_names: boolInclude field names (for tree-sitter nodes)
line_width_limit: usizeTruncate long lines to this width (0 = no truncation)
Implementations§
Source§impl PrintConfig
impl PrintConfig
Sourcepub fn with_format(self, format: PrintFormat) -> Self
pub fn with_format(self, format: PrintFormat) -> Self
Set output format
Sourcepub fn with_snippets(self, enabled: bool) -> Self
pub fn with_snippets(self, enabled: bool) -> Self
Enable/disable snippets
Sourcepub fn with_line_info(self, enabled: bool) -> Self
pub fn with_line_info(self, enabled: bool) -> Self
Enable/disable line information
Sourcepub fn with_snippet_width(self, width: usize) -> Self
pub fn with_snippet_width(self, width: usize) -> Self
Set snippet display width
Sourcepub fn with_snippet_max_length(self, length: usize) -> Self
pub fn with_snippet_max_length(self, length: usize) -> Self
Set maximum snippet length before truncation
Sourcepub fn with_max_depth(self, depth: usize) -> Self
pub fn with_max_depth(self, depth: usize) -> Self
Set maximum nesting depth
Sourcepub fn with_indent_width(self, width: usize) -> Self
pub fn with_indent_width(self, width: usize) -> Self
Set indentation width
Sourcepub fn with_node_ids(self, enabled: bool) -> Self
pub fn with_node_ids(self, enabled: bool) -> Self
Enable/disable node IDs
Sourcepub fn with_field_names(self, enabled: bool) -> Self
pub fn with_field_names(self, enabled: bool) -> Self
Enable/disable field names
Sourcepub fn with_line_width_limit(self, width: usize) -> Self
pub fn with_line_width_limit(self, width: usize) -> Self
Set line width limit
Sourcepub fn minimal() -> Self
pub fn minimal() -> Self
Minimal configuration (fastest rendering)
Disables snippets, line info, and node IDs for maximum speed
Trait Implementations§
Source§impl Clone for PrintConfig
impl Clone for PrintConfig
Source§fn clone(&self) -> PrintConfig
fn clone(&self) -> PrintConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PrintConfig
impl Debug for PrintConfig
Auto Trait Implementations§
impl Freeze for PrintConfig
impl RefUnwindSafe for PrintConfig
impl Send for PrintConfig
impl Sync for PrintConfig
impl Unpin for PrintConfig
impl UnwindSafe for PrintConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more