Module formatter

Module formatter 

Source
Expand description

Format a Value into JASN text.

The main entry points are format() and format_pretty() for common use cases. For custom formatting options, use format_with_opts() with Options.

use jasn::{Value, format};

let value = Value::String("hello".to_string());
assert_eq!(format(&value), r#""hello""#);

// Custom formatting with advanced options
use jasn::formatter::{Options, format_with_opts};
let opts = Options::pretty().with_indent("\t");
let formatted = format_with_opts(&value, &opts);

Structs§

Options
Formatting options for JASN output.

Enums§

BinaryEncoding
Binary data encoding preference.
QuoteStyle
Quote style for strings and map keys.
TimestampPrecision
Precision for timestamp fractional seconds.

Functions§

format
Formats a JASN Value into a compact string (no unnecessary whitespace).
format_pretty
Formats a JASN Value into a pretty-printed string with indentation and newlines.
format_with_opts
Formats a JASN Value with custom formatting options.