#[non_exhaustive]pub struct TjsonOptions { /* private fields */ }Expand description
Options controlling how TJSON is rendered. Use TjsonOptions::default for sensible
defaults, or TjsonOptions::canonical for a compact, diff-friendly format.
All fields are set via builder methods.
Implementations§
Source§impl TjsonOptions
impl TjsonOptions
Sourcepub fn canonical() -> Self
pub fn canonical() -> Self
Returns options that produce canonical TJSON: one key-value pair per line, no inline packing, no tables, no multiline strings, no folding.
Sourcepub fn force_markers(self, force_markers: bool) -> Self
pub fn force_markers(self, force_markers: bool) -> Self
When true, force explicit [ / { markers even for non-empty arrays and objects
that would normally use implicit (marker-free) layout. Default is false.
Sourcepub fn bare_strings(self, bare_strings: BareStyle) -> Self
pub fn bare_strings(self, bare_strings: BareStyle) -> Self
Controls whether string values are rendered bare (unquoted) when possible. Default is Prefer.
Sourcepub fn bare_keys(self, bare_keys: BareStyle) -> Self
pub fn bare_keys(self, bare_keys: BareStyle) -> Self
Controls whether object keys are rendered bare (unquoted) when possible. Default is Prefer.
Sourcepub fn inline_objects(self, inline_objects: bool) -> Self
pub fn inline_objects(self, inline_objects: bool) -> Self
When true, pack small objects onto a single line when they fit within wrap_width. Default is true.
Sourcepub fn inline_arrays(self, inline_arrays: bool) -> Self
pub fn inline_arrays(self, inline_arrays: bool) -> Self
When true, pack small arrays onto a single line when they fit within wrap_width. Default is true.
Sourcepub fn string_array_style(self, string_array_style: StringArrayStyle) -> Self
pub fn string_array_style(self, string_array_style: StringArrayStyle) -> Self
Controls how arrays of short strings are packed. Default is PreferComma.
Sourcepub fn tables(self, tables: bool) -> Self
pub fn tables(self, tables: bool) -> Self
When true, render homogeneous arrays of objects as pipe tables when they meet the minimum row, column, and similarity thresholds. Default is true.
Sourcepub fn wrap_width(self, wrap_width: Option<usize>) -> Self
pub fn wrap_width(self, wrap_width: Option<usize>) -> Self
Set the wrap width. None means no wrap limit (infinite width). Values below 20 are
clamped to 20 — use wrap_width_checked if you want an
error instead.
Sourcepub fn wrap_width_checked(
self,
wrap_width: Option<usize>,
) -> Result<Self, String>
pub fn wrap_width_checked( self, wrap_width: Option<usize>, ) -> Result<Self, String>
Set the wrap width with validation. None means no wrap limit (infinite width).
Returns an error if the value is Some(n) where n < 10.
Use wrap_width if you want clamping instead.
Sourcepub fn table_min_rows(self, table_min_rows: usize) -> Self
pub fn table_min_rows(self, table_min_rows: usize) -> Self
Minimum number of data rows an array must have to be rendered as a table. Default is 3.
Sourcepub fn table_min_cols(self, table_min_cols: usize) -> Self
pub fn table_min_cols(self, table_min_cols: usize) -> Self
Minimum number of columns a table must have to be rendered as a pipe table. Default is 3.
Sourcepub fn table_min_similarity(self, v: f32) -> Self
pub fn table_min_similarity(self, v: f32) -> Self
Minimum cell-fill fraction required for table rendering. Computed as
filled_cells / (rows × columns) where filled_cells is the count of
(row, column) pairs where the row’s object actually has that key. A value
of 1.0 requires every row to have every column; 0.0 allows fully sparse
tables. Range 0.0–1.0; default is 0.8.
Sourcepub fn table_column_max_width(self, table_column_max_width: usize) -> Self
pub fn table_column_max_width(self, table_column_max_width: usize) -> Self
Maximum rendered width (in characters) of any single table column. Default is 40.
Sourcepub fn number_fold_style(self, style: FoldStyle) -> Self
pub fn number_fold_style(self, style: FoldStyle) -> Self
Fold style for numbers. Auto folds before ./e/E first, then between digits.
Fixed folds between any two digits at the wrap limit. Default is None.
Sourcepub fn string_bare_fold_style(self, style: FoldStyle) -> Self
pub fn string_bare_fold_style(self, style: FoldStyle) -> Self
Fold style for bare strings. Default is Auto.
Sourcepub fn string_quoted_fold_style(self, style: FoldStyle) -> Self
pub fn string_quoted_fold_style(self, style: FoldStyle) -> Self
Fold style for quoted strings. Default is Auto.
Sourcepub fn string_multiline_fold_style(self, style: FoldStyle) -> Self
pub fn string_multiline_fold_style(self, style: FoldStyle) -> Self
Fold style within ` and `` multiline string bodies. Default is None.
Note: ``` (Transparent) multilines cannot fold regardless of this setting —
the spec does not allow / continuations inside triple-backtick blocks.
Sourcepub fn table_fold(self, table_fold: bool) -> Self
pub fn table_fold(self, table_fold: bool) -> Self
When true, emit \ fold continuations for wide table cells. Off by default —
the spec notes that table folds are almost always a bad idea.
Sourcepub fn table_unindent_style(self, style: TableUnindentStyle) -> Self
pub fn table_unindent_style(self, style: TableUnindentStyle) -> Self
Controls table horizontal repositioning via /< /> indent-offset glyphs. Default is Auto.
Note: indent_glyph_style must not be None for glyphs
to appear — table_unindent_style decides when to unindent; indent_glyph_style
decides whether glyphs are permitted at all.
Sourcepub fn indent_glyph_style(self, style: IndentGlyphStyle) -> Self
pub fn indent_glyph_style(self, style: IndentGlyphStyle) -> Self
Controls when /< / /> indent-offset glyphs are applied. Default is Auto.
Sourcepub fn indent_glyph_marker_style(self, style: IndentGlyphMarkerStyle) -> Self
pub fn indent_glyph_marker_style(self, style: IndentGlyphMarkerStyle) -> Self
Controls how the /< opening glyph is placed relative to its key. Default is Compact.
Sourcepub fn multiline_strings(self, multiline_strings: bool) -> Self
pub fn multiline_strings(self, multiline_strings: bool) -> Self
When true, render strings containing newlines using multiline syntax (`, ``, or ```).
When false, all strings are rendered as JSON strings. Default is true.
Sourcepub fn multiline_style(self, multiline_style: MultilineStyle) -> Self
pub fn multiline_style(self, multiline_style: MultilineStyle) -> Self
Preferred multiline string rendering style. Default is Bold.
Sourcepub fn multiline_min_lines(self, multiline_min_lines: usize) -> Self
pub fn multiline_min_lines(self, multiline_min_lines: usize) -> Self
Minimum number of newlines a string must contain to be rendered as multiline. 0 is treated as 1. Default is 1.
Sourcepub fn multiline_max_lines(self, multiline_max_lines: usize) -> Self
pub fn multiline_max_lines(self, multiline_max_lines: usize) -> Self
Maximum number of content lines before Floating falls back to Bold. 0 means no limit. Default is 10.
Trait Implementations§
Source§impl Clone for TjsonOptions
impl Clone for TjsonOptions
Source§fn clone(&self) -> TjsonOptions
fn clone(&self) -> TjsonOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more