pub struct Options {
pub indent: String,
pub trailing_commas: bool,
pub quote_style: QuoteStyle,
pub binary_encoding: BinaryEncoding,
pub unquoted_keys: bool,
pub leading_plus: bool,
pub sort_keys: bool,
pub escape_unicode: bool,
pub use_zulu: bool,
pub timestamp_precision: TimestampPrecision,
}Expand description
Formatting options for JASN output.
Fields§
§indent: StringIndentation string (e.g., “ “ or “\t”). Empty string means compact output.
trailing_commas: boolAdd trailing commas to lists and maps.
quote_style: QuoteStyleQuote style for strings.
binary_encoding: BinaryEncodingBinary data encoding preference.
unquoted_keys: boolUse unquoted keys in maps when possible.
leading_plus: boolAdd leading plus sign to positive numbers (+42, +3.14, +inf).
sort_keys: boolSort map keys alphabetically for consistent output.
escape_unicode: boolEscape all non-ASCII characters as \uXXXX sequences.
use_zulu: boolUse ‘Z’ for UTC timestamps instead of ‘+00:00’.
timestamp_precision: TimestampPrecisionPrecision for timestamp fractional seconds.
Implementations§
Source§impl Options
impl Options
Sourcepub fn with_indent(self, indent: impl Into<String>) -> Self
pub fn with_indent(self, indent: impl Into<String>) -> Self
Sets the indentation string.
Sourcepub fn with_trailing_commas(self, enable: bool) -> Self
pub fn with_trailing_commas(self, enable: bool) -> Self
Sets whether to use trailing commas.
Sourcepub fn with_quote_style(self, style: QuoteStyle) -> Self
pub fn with_quote_style(self, style: QuoteStyle) -> Self
Sets the quote style.
Sourcepub fn with_binary_encoding(self, encoding: BinaryEncoding) -> Self
pub fn with_binary_encoding(self, encoding: BinaryEncoding) -> Self
Sets the binary encoding preference.
Sourcepub fn with_unquoted_keys(self, enable: bool) -> Self
pub fn with_unquoted_keys(self, enable: bool) -> Self
Sets whether to use unquoted keys.
Sourcepub fn with_leading_plus(self, enable: bool) -> Self
pub fn with_leading_plus(self, enable: bool) -> Self
Sets whether to add leading plus sign to positive numbers.
Sourcepub fn with_sort_keys(self, enable: bool) -> Self
pub fn with_sort_keys(self, enable: bool) -> Self
Sets whether to sort map keys alphabetically.
Sourcepub fn with_escape_unicode(self, enable: bool) -> Self
pub fn with_escape_unicode(self, enable: bool) -> Self
Sets whether to escape non-ASCII characters as \uXXXX.
Sourcepub fn with_use_zulu(self, enable: bool) -> Self
pub fn with_use_zulu(self, enable: bool) -> Self
Sets whether to use ‘Z’ for UTC timestamps instead of ‘+00:00’.
Sourcepub fn with_timestamp_precision(self, precision: TimestampPrecision) -> Self
pub fn with_timestamp_precision(self, precision: TimestampPrecision) -> Self
Sets the precision for timestamp fractional seconds.