1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// =============================================================================
// Copyright (c) 2026 Haixing Hu.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0.
// =============================================================================
//! Options for whitespace-only JSON token formatting.
use JsonPrettyOptionsBuilder;
/// Controls indentation and the optional final newline in pretty output.
///
/// The default is two spaces per level, no displayed-depth cap, and no final
/// newline. A displayed-depth cap changes indentation only; it does not limit
/// the actual nesting depth accepted by the formatter.
///
/// # Examples
///
/// ```
/// use qubit_json::format::{format_json_tokens, JsonPrettyOptions};
///
/// let options = JsonPrettyOptions::builder()
/// .indent_width(2)
/// .trailing_newline(true)
/// .build()?;
/// let output = format_json_tokens(b"[1]", &options, None)?;
/// assert_eq!(output, b"[\n 1\n]\n");
/// # Ok::<(), Box<dyn std::error::Error>>(())
/// ```